diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-09-06 13:56:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:37:01 -0400 |
commit | 30650961907368b1077cade35455fe931b14da6b (patch) | |
tree | a27bbcb9319529b6d13da933adff4c069a12b853 /drivers/media/common | |
parent | 2a6003c20771ca16fc6386b5fd258df2f2fa8232 (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')
-rw-r--r-- | drivers/media/common/tuners/xc5000.c | 9 | ||||
-rw-r--r-- | drivers/media/common/tuners/xc5000.h | 6 |
2 files changed, 7 insertions, 8 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 72efc656ad0d..ccc4dae4126a 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
@@ -59,7 +59,6 @@ struct xc5000_priv { | |||
59 | u8 video_standard; | 59 | u8 video_standard; |
60 | u8 rf_mode; | 60 | u8 rf_mode; |
61 | 61 | ||
62 | void *devptr; | ||
63 | int (*tuner_callback) (void *priv, int command, int arg); | 62 | int (*tuner_callback) (void *priv, int command, int arg); |
64 | }; | 63 | }; |
65 | 64 | ||
@@ -234,7 +233,10 @@ static void xc5000_TunerReset(struct dvb_frontend *fe) | |||
234 | dprintk(1, "%s()\n", __func__); | 233 | dprintk(1, "%s()\n", __func__); |
235 | 234 | ||
236 | if (priv->tuner_callback) { | 235 | if (priv->tuner_callback) { |
237 | ret = priv->tuner_callback(priv->devptr, XC5000_TUNER_RESET, 0); | 236 | ret = priv->tuner_callback(((fe->dvb) && (fe->dvb->priv)) ? |
237 | fe->dvb->priv : | ||
238 | priv->i2c_props.adap->algo_data, | ||
239 | XC5000_TUNER_RESET, 0); | ||
238 | if (ret) | 240 | if (ret) |
239 | printk(KERN_ERR "xc5000: reset failed\n"); | 241 | printk(KERN_ERR "xc5000: reset failed\n"); |
240 | } else | 242 | } else |
@@ -950,7 +952,7 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = { | |||
950 | 952 | ||
951 | struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | 953 | struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, |
952 | struct i2c_adapter *i2c, | 954 | struct i2c_adapter *i2c, |
953 | struct xc5000_config *cfg, void *devptr) | 955 | struct xc5000_config *cfg) |
954 | { | 956 | { |
955 | struct xc5000_priv *priv = NULL; | 957 | struct xc5000_priv *priv = NULL; |
956 | int instance; | 958 | int instance; |
@@ -972,7 +974,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | |||
972 | case 1: | 974 | case 1: |
973 | /* new tuner instance */ | 975 | /* new tuner instance */ |
974 | priv->bandwidth = BANDWIDTH_6_MHZ; | 976 | priv->bandwidth = BANDWIDTH_6_MHZ; |
975 | priv->devptr = devptr; | ||
976 | priv->if_khz = cfg->if_khz; | 977 | priv->if_khz = cfg->if_khz; |
977 | priv->tuner_callback = cfg->tuner_callback; | 978 | priv->tuner_callback = cfg->tuner_callback; |
978 | 979 | ||
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h index 5389f740945a..fa0321cfd179 100644 --- a/drivers/media/common/tuners/xc5000.h +++ b/drivers/media/common/tuners/xc5000.h | |||
@@ -49,13 +49,11 @@ struct xc5000_config { | |||
49 | (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE)) | 49 | (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE)) |
50 | extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, | 50 | extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, |
51 | struct i2c_adapter *i2c, | 51 | struct i2c_adapter *i2c, |
52 | struct xc5000_config *cfg, | 52 | struct xc5000_config *cfg); |
53 | void *devptr); | ||
54 | #else | 53 | #else |
55 | static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, | 54 | static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, |
56 | struct i2c_adapter *i2c, | 55 | struct i2c_adapter *i2c, |
57 | struct xc5000_config *cfg, | 56 | struct xc5000_config *cfg) |
58 | void *devptr) | ||
59 | { | 57 | { |
60 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 58 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
61 | return NULL; | 59 | return NULL; |