aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-22 13:46:11 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:53 -0400
commitb412ba781adcb484e8d9b19b30ae1d3a6b8c7d29 (patch)
tree02997fa52c69c3f63079e01d22ba53969e214d54 /drivers
parent0be51b4671b3ae3ae544a0bb3d15b55478b55e72 (diff)
V4L/DVB (7399): 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 <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c1
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c1
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c2
-rw-r--r--drivers/media/video/tuner-core.c1
-rw-r--r--drivers/media/video/tuner-xc2028.c15
5 files changed, 12 insertions, 8 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index c58365005ac1..8aff70217635 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -509,7 +509,6 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
509 struct xc2028_config cfg = { 509 struct xc2028_config cfg = {
510 .i2c_adap = &adap->dev->i2c_adap, 510 .i2c_adap = &adap->dev->i2c_adap,
511 .i2c_addr = 0x61, 511 .i2c_addr = 0x61,
512 .video_dev = adap->dev,
513 .callback = dvico_bluebird_xc2028_callback, 512 .callback = dvico_bluebird_xc2028_callback,
514 }; 513 };
515 static struct xc2028_ctrl ctl = { 514 static struct xc2028_ctrl ctl = {
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 22381de7359e..5549a9d73a5c 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -297,7 +297,6 @@ static int dvb_register(struct cx23885_tsport *port)
297 struct xc2028_config cfg = { 297 struct xc2028_config cfg = {
298 .i2c_adap = &i2c_bus->i2c_adap, 298 .i2c_adap = &i2c_bus->i2c_adap,
299 .i2c_addr = 0x61, 299 .i2c_addr = 0x61,
300 .video_dev = port,
301 .callback = cx23885_hvr1500_xc3028_callback, 300 .callback = cx23885_hvr1500_xc3028_callback,
302 }; 301 };
303 static struct xc2028_ctrl ctl = { 302 static struct xc2028_ctrl ctl = {
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 37ebfcc6be55..bbbde6d7dab9 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -458,7 +458,6 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
458 struct xc2028_config cfg = { 458 struct xc2028_config cfg = {
459 .i2c_adap = &dev->core->i2c_adap, 459 .i2c_adap = &dev->core->i2c_adap,
460 .i2c_addr = addr, 460 .i2c_addr = addr,
461 .video_dev = dev->core->i2c_adap.algo_data,
462 }; 461 };
463 462
464 if (!dev->dvb.frontend) { 463 if (!dev->dvb.frontend) {
@@ -780,7 +779,6 @@ static int dvb_register(struct cx8802_dev *dev)
780 struct xc2028_config cfg = { 779 struct xc2028_config cfg = {
781 .i2c_adap = &dev->core->i2c_adap, 780 .i2c_adap = &dev->core->i2c_adap,
782 .i2c_addr = 0x61, 781 .i2c_addr = 0x61,
783 .video_dev = dev->core,
784 .callback = cx88_pci_nano_callback, 782 .callback = cx88_pci_nano_callback,
785 }; 783 };
786 static struct xc2028_ctrl ctl = { 784 static struct xc2028_ctrl ctl = {
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 4b936b809d78..225e8f8df1a5 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -419,7 +419,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
419 struct xc2028_config cfg = { 419 struct xc2028_config cfg = {
420 .i2c_adap = t->i2c->adapter, 420 .i2c_adap = t->i2c->adapter,
421 .i2c_addr = t->i2c->addr, 421 .i2c_addr = t->i2c->addr,
422 .video_dev = c->adapter->algo_data,
423 .callback = t->tuner_callback, 422 .callback = t->tuner_callback,
424 }; 423 };
425 if (!xc2028_attach(&t->fe, &cfg)) { 424 if (!xc2028_attach(&t->fe, &cfg)) {
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c
index a9caae1af49d..0b5ba67a4da5 100644
--- a/drivers/media/video/tuner-xc2028.c
+++ b/drivers/media/video/tuner-xc2028.c
@@ -1155,7 +1155,7 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
1155 if (debug) 1155 if (debug)
1156 printk(KERN_DEBUG "xc2028: Xcv2028/3028 init called!\n"); 1156 printk(KERN_DEBUG "xc2028: Xcv2028/3028 init called!\n");
1157 1157
1158 if (NULL == cfg || NULL == cfg->video_dev) 1158 if (NULL == cfg)
1159 return NULL; 1159 return NULL;
1160 1160
1161 if (!fe) { 1161 if (!fe) {
@@ -1163,13 +1163,19 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
1163 return NULL; 1163 return NULL;
1164 } 1164 }
1165 1165
1166 video_dev = cfg->video_dev; 1166 video_dev = cfg->i2c_adap->algo_data;
1167
1168 if (debug)
1169 printk(KERN_DEBUG "xc2028: video_dev =%p\n", video_dev);
1167 1170
1168 mutex_lock(&xc2028_list_mutex); 1171 mutex_lock(&xc2028_list_mutex);
1169 1172
1170 list_for_each_entry(priv, &xc2028_list, xc2028_list) { 1173 list_for_each_entry(priv, &xc2028_list, xc2028_list) {
1171 if (priv->video_dev == cfg->video_dev) { 1174 if (&priv->i2c_props.adap->dev == &cfg->i2c_adap->dev) {
1172 video_dev = NULL; 1175 video_dev = NULL;
1176 if (debug)
1177 printk(KERN_DEBUG "xc2028: reusing device\n");
1178
1173 break; 1179 break;
1174 } 1180 }
1175 } 1181 }
@@ -1197,6 +1203,9 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
1197 fe->tuner_priv = priv; 1203 fe->tuner_priv = priv;
1198 priv->count++; 1204 priv->count++;
1199 1205
1206 if (debug)
1207 printk(KERN_DEBUG "xc2028: usage count is %i\n", priv->count);
1208
1200 memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops, 1209 memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops,
1201 sizeof(xc2028_dvb_tuner_ops)); 1210 sizeof(xc2028_dvb_tuner_ops));
1202 1211