summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common/tuners/xc5000.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-09-06 13:56:58 -0400
committerMichael Krufky <mkrufky@linuxtv.org>2008-09-06 13:56:58 -0400
commit507449b0440221c834914389d808f4728dcd2702 (patch)
treef2d7d16845daed6ebc5fa25d1f5ea66526d7aa20 /linux/drivers/media/common/tuners/xc5000.c
parent8cab49c4acd229cb28d9add11a80eed55859ba2d (diff)
downloadmediapointer-dvb-s2-507449b0440221c834914389d808f4728dcd2702.tar.gz
mediapointer-dvb-s2-507449b0440221c834914389d808f4728dcd2702.tar.bz2
xc5000: dont pass devptr in xc5000_attach()
From: Michael Krufky <mkrufky@linuxtv.org> 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. Priority: normal Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/common/tuners/xc5000.c')
-rw-r--r--linux/drivers/media/common/tuners/xc5000.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/linux/drivers/media/common/tuners/xc5000.c b/linux/drivers/media/common/tuners/xc5000.c
index 134366525..7d4d82d23 100644
--- a/linux/drivers/media/common/tuners/xc5000.c
+++ b/linux/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
@@ -969,7 +971,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;
@@ -991,7 +993,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;