]> err.no Git - linux-2.6/commitdiff
V4L/DVB (7399): Removes video_dev from tuner-xc2028 config struct
authorMauro Carvalho Chehab <mchehab@infradead.org>
Tue, 22 Apr 2008 17:46:11 +0000 (14:46 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:07:53 +0000 (14:07 -0300)
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>
drivers/media/dvb/dvb-usb/cxusb.c
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/tuner-core.c
drivers/media/video/tuner-xc2028.c

index c58365005ac1cb32e0f7739918f6e3b3f8a37a97..8aff7021763524254fa92f0f3ba46a316b426f45 100644 (file)
@@ -509,7 +509,6 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
        struct xc2028_config      cfg = {
                .i2c_adap  = &adap->dev->i2c_adap,
                .i2c_addr  = 0x61,
-               .video_dev = adap->dev,
                .callback  = dvico_bluebird_xc2028_callback,
        };
        static struct xc2028_ctrl ctl = {
index 22381de7359e287d4fc3def98ac31534913d1924..5549a9d73a5c608b239700fb7d907fb405514b31 100644 (file)
@@ -297,7 +297,6 @@ static int dvb_register(struct cx23885_tsport *port)
                        struct xc2028_config cfg = {
                                .i2c_adap  = &i2c_bus->i2c_adap,
                                .i2c_addr  = 0x61,
-                               .video_dev = port,
                                .callback  = cx23885_hvr1500_xc3028_callback,
                        };
                        static struct xc2028_ctrl ctl = {
index 37ebfcc6be55df3016fcc3fe7a6a3df6647bd69c..bbbde6d7dab9e58d85cbda234e1e88727931f9a1 100644 (file)
@@ -458,7 +458,6 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
        struct xc2028_config cfg = {
                .i2c_adap  = &dev->core->i2c_adap,
                .i2c_addr  = addr,
-               .video_dev = dev->core->i2c_adap.algo_data,
        };
 
        if (!dev->dvb.frontend) {
@@ -780,7 +779,6 @@ static int dvb_register(struct cx8802_dev *dev)
                        struct xc2028_config cfg = {
                                .i2c_adap  = &dev->core->i2c_adap,
                                .i2c_addr  = 0x61,
-                               .video_dev = dev->core,
                                .callback  = cx88_pci_nano_callback,
                        };
                        static struct xc2028_ctrl ctl = {
index 4b936b809d78b694915cffecc4001c1b022f7b2a..225e8f8df1a55f6532fd1bd098a0155ccc6a7879 100644 (file)
@@ -419,7 +419,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
                struct xc2028_config cfg = {
                        .i2c_adap  = t->i2c->adapter,
                        .i2c_addr  = t->i2c->addr,
-                       .video_dev = c->adapter->algo_data,
                        .callback  = t->tuner_callback,
                };
                if (!xc2028_attach(&t->fe, &cfg)) {
index a9caae1af49ddc3931873acd57a0a1a4915c2102..0b5ba67a4da53bf621fb3f763565d4d00118b102 100644 (file)
@@ -1155,7 +1155,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) {
@@ -1163,13 +1163,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;
                }
        }
@@ -1197,6 +1203,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));