aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/common/tuners
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-09-06 14:56:58 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 09:37:01 -0200
commit30650961907368b1077cade35455fe931b14da6b (patch)
treea27bbcb9319529b6d13da933adff4c069a12b853 /drivers/media/common/tuners
parent2a6003c20771ca16fc6386b5fd258df2f2fa8232 (diff)
V4L/DVB (8951): xc5000: dont pass devptr in xc5000_attach()
Dont pass devptr in xc5000_attach, dont store it in xc5000_priv. This pointer is passed into the tuner_callback function, which always expects a pointer to fe->dvb->priv or i2c_adapter->algo_data. This prevents future possible bugs in new drivers, such as using a "devptr" other that the standard fe->dvb->priv in a DVB driver. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/tuners')
-rw-r--r--drivers/media/common/tuners/xc5000.c9
-rw-r--r--drivers/media/common/tuners/xc5000.h6
2 files changed, 7 insertions, 8 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index 72efc656ad0..ccc4dae4126 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -59,7 +59,6 @@ struct xc5000_priv {
u8 video_standard;
u8 rf_mode;
- void *devptr;
int (*tuner_callback) (void *priv, int command, int arg);
};
@@ -234,7 +233,10 @@ static void xc5000_TunerReset(struct dvb_frontend *fe)
dprintk(1, "%s()\n", __func__);
if (priv->tuner_callback) {
- ret = priv->tuner_callback(priv->devptr, XC5000_TUNER_RESET, 0);
+ ret = priv->tuner_callback(((fe->dvb) && (fe->dvb->priv)) ?
+ fe->dvb->priv :
+ priv->i2c_props.adap->algo_data,
+ XC5000_TUNER_RESET, 0);
if (ret)
printk(KERN_ERR "xc5000: reset failed\n");
} else
@@ -950,7 +952,7 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = {
struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c,
- struct xc5000_config *cfg, void *devptr)
+ struct xc5000_config *cfg)
{
struct xc5000_priv *priv = NULL;
int instance;
@@ -972,7 +974,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
case 1:
/* new tuner instance */
priv->bandwidth = BANDWIDTH_6_MHZ;
- priv->devptr = devptr;
priv->if_khz = cfg->if_khz;
priv->tuner_callback = cfg->tuner_callback;
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h
index 5389f740945..fa0321cfd17 100644
--- a/drivers/media/common/tuners/xc5000.h
+++ b/drivers/media/common/tuners/xc5000.h
@@ -49,13 +49,11 @@ struct xc5000_config {
(defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE))
extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c,
- struct xc5000_config *cfg,
- void *devptr);
+ struct xc5000_config *cfg);
#else
static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c,
- struct xc5000_config *cfg,
- void *devptr)
+ struct xc5000_config *cfg)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;