aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/dvb/dvb-core
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-12-30 11:30:21 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-31 10:28:23 -0200
commit7c61d80a9bcfc3fdec8ffd75756cad6a64678229 (patch)
treecd62cf4852ba56a7a5f12cc630cae44000393f34 /drivers/media/dvb/dvb-core
parentac3852c41b36cb408bea1400892dd6c61c3b225a (diff)
[media] dvb: don't require a parameter for get_frontend
Just like set_frontend, use the dvb cache properties for get_frontend. This is more consistent, as both functions are now symetric. Also, at the places get_frontend is called, it makes sense to update the cache. Most of this patch were generated by this small perl script: while (<>) { $file .= $_; } if ($file =~ m/\.get_frontend\s*=\s*([\d\w_]+)/) { my $get = $1; $file =~ s/($get)(\s*\([^\,\)]+)\,\s*struct\s+dtv_frontend_properties\s*\*\s*([_\d\w]+)\)\s*\{/\1\2)\n{\n\tstruct dtv_frontend_properties *\3 = &fe->dtv_property_cache;/g; } print $file; Of course, the changes at dvb_frontend.[ch] were made by hand, as well as the changes on a few other places, where get_frontend() is called internally inside the driver. On some places, get_frontend() were just a void function. Those occurrences were removed, as the DVB core handles such cases. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-core')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c30
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.h2
2 files changed, 8 insertions, 24 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 0ab473cc4b1..d030cd3de64 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -143,7 +143,6 @@ struct dvb_frontend_private {
static void dvb_frontend_wakeup(struct dvb_frontend *fe);
static int dtv_get_frontend(struct dvb_frontend *fe,
- struct dtv_frontend_properties *c,
struct dvb_frontend_parameters *p_out);
static bool has_get_frontend(struct dvb_frontend *fe)
@@ -161,7 +160,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
dprintk ("%s\n", __func__);
if ((status & FE_HAS_LOCK) && has_get_frontend(fe))
- dtv_get_frontend(fe, NULL, &fepriv->parameters_out);
+ dtv_get_frontend(fe, &fepriv->parameters_out);
mutex_lock(&events->mtx);
@@ -1261,33 +1260,20 @@ static void dtv_property_cache_submit(struct dvb_frontend *fe)
* If p_out is not null, it will update the DVBv3 params pointed by it.
*/
static int dtv_get_frontend(struct dvb_frontend *fe,
- struct dtv_frontend_properties *c,
struct dvb_frontend_parameters *p_out)
{
- const struct dtv_frontend_properties *cache = &fe->dtv_property_cache;
- struct dtv_frontend_properties tmp_cache;
- struct dvb_frontend_parameters tmp_out;
- bool fill_params = (p_out != NULL);
int r;
- if (!p_out)
- p_out = &tmp_out;
-
- if (!c)
- c = &tmp_cache;
- else
- memcpy(c, cache, sizeof(*c));
-
if (fe->ops.get_frontend) {
- r = fe->ops.get_frontend(fe, c);
+ r = fe->ops.get_frontend(fe);
if (unlikely(r < 0))
return r;
- if (fill_params)
+ if (p_out)
dtv_property_legacy_params_sync(fe, p_out);
return 0;
}
- /* As everything is in cache, this is always supported */
+ /* As everything is in cache, get_frontend fops are always supported */
return 0;
}
@@ -1717,8 +1703,6 @@ static int dvb_frontend_ioctl_properties(struct file *file,
} else
if(cmd == FE_GET_PROPERTY) {
- struct dtv_frontend_properties cache_out;
-
tvps = (struct dtv_properties __user *)parg;
dprintk("%s() properties.num = %d\n", __func__, tvps->num);
@@ -1744,9 +1728,9 @@ static int dvb_frontend_ioctl_properties(struct file *file,
* Fills the cache out struct with the cache contents, plus
* the data retrieved from get_frontend.
*/
- dtv_get_frontend(fe, &cache_out, NULL);
+ dtv_get_frontend(fe, NULL);
for (i = 0; i < tvps->num; i++) {
- err = dtv_property_process_get(fe, &cache_out, tvp + i, file);
+ err = dtv_property_process_get(fe, c, tvp + i, file);
if (err < 0)
goto out;
(tvp + i)->result = err;
@@ -2043,7 +2027,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
break;
case FE_GET_FRONTEND:
- err = dtv_get_frontend(fe, NULL, &fepriv->parameters_out);
+ err = dtv_get_frontend(fe, &fepriv->parameters_out);
if (err >= 0)
memcpy(parg, &fepriv->parameters_out,
sizeof(struct dvb_frontend_parameters));
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 676481c8ad7..0a080c3d007 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -284,7 +284,7 @@ struct dvb_frontend_ops {
int (*set_frontend)(struct dvb_frontend *fe);
int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings);
- int (*get_frontend)(struct dvb_frontend *fe, struct dtv_frontend_properties *props);
+ int (*get_frontend)(struct dvb_frontend *fe);
int (*read_status)(struct dvb_frontend* fe, fe_status_t* status);
int (*read_ber)(struct dvb_frontend* fe, u32* ber);