From a8920577550dfde4d79e6a6f4ca1ac72f4cf4bd3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 21 Mar 2008 08:04:55 -0300 Subject: Removes video_dev from tuner-xc2028 config struct The video_dev parameter, on tuner-xc2028 were used to pass i2c private data to tuner_callback. Since the driver already have a pointer to i2c_adap->algo_data, uses this instead. This parameter were used also as a magic number to idenfity if two drivers are trying to register the same xc3028 tuner. This occurs with boards with DVB support, where both DVB and V4L drivers will share the same tuner. Instead of using the algo_data as a private number, after this patch, the driver will use i2c_adap->dev, with seems more consistent. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/tuner-xc2028.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'linux/drivers/media/video/tuner-xc2028.c') diff --git a/linux/drivers/media/video/tuner-xc2028.c b/linux/drivers/media/video/tuner-xc2028.c index bfa6ac740..5b443965b 100644 --- a/linux/drivers/media/video/tuner-xc2028.c +++ b/linux/drivers/media/video/tuner-xc2028.c @@ -1174,7 +1174,7 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, if (debug) printk(KERN_DEBUG "xc2028: Xcv2028/3028 init called!\n"); - if (NULL == cfg || NULL == cfg->video_dev) + if (NULL == cfg) return NULL; if (!fe) { @@ -1182,13 +1182,19 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, return NULL; } - video_dev = cfg->video_dev; + video_dev = cfg->i2c_adap->algo_data; + + if (debug) + printk(KERN_DEBUG "xc2028: video_dev =%p\n", video_dev); mutex_lock(&xc2028_list_mutex); list_for_each_entry(priv, &xc2028_list, xc2028_list) { - if (priv->video_dev == cfg->video_dev) { + if (&priv->i2c_props.adap->dev == &cfg->i2c_adap->dev) { video_dev = NULL; + if (debug) + printk(KERN_DEBUG "xc2028: reusing device\n"); + break; } } @@ -1216,6 +1222,9 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, fe->tuner_priv = priv; priv->count++; + if (debug) + printk(KERN_DEBUG "xc2028: usage count is %i\n", priv->count); + memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops, sizeof(xc2028_dvb_tuner_ops)); -- cgit v1.2.3