i2c: Drivers stop using the redundant client list
[deliverable/linux.git] / drivers / media / video / mxb.c
index eb3b31867494b0ac0bf97ae08f94c7c84d48ae20..add6d0d680bed7fc8e43ac6d687232cd12627ab9 100644 (file)
@@ -149,21 +149,39 @@ struct mxb
 
 static struct saa7146_extension extension;
 
+static int mxb_check_clients(struct device *dev, void *data)
+{
+       struct mxb* mxb = data;
+       struct i2c_client *client = i2c_verify_client(dev);
+
+       if( !client )
+               return 0;
+
+       if( I2C_ADDR_TEA6420_1 == client->addr )
+               mxb->tea6420_1 = client;
+       if( I2C_ADDR_TEA6420_2 == client->addr )
+               mxb->tea6420_2 = client;
+       if( I2C_TEA6415C_2 == client->addr )
+               mxb->tea6415c = client;
+       if( I2C_ADDR_TDA9840 == client->addr )
+               mxb->tda9840 = client;
+       if( I2C_SAA7111 == client->addr )
+               mxb->saa7111a = client;
+       if( 0x60 == client->addr )
+               mxb->tuner = client;
+
+       return 0;
+}
+
 static int mxb_probe(struct saa7146_dev* dev)
 {
        struct mxb* mxb = NULL;
-       struct i2c_client *client;
-       struct list_head *item;
        int result;
 
        if ((result = request_module("saa7111")) < 0) {
                printk("mxb: saa7111 i2c module not available.\n");
                return -ENODEV;
        }
-       if ((result = request_module("tuner")) < 0) {
-               printk("mxb: tuner i2c module not available.\n");
-               return -ENODEV;
-       }
        if ((result = request_module("tea6420")) < 0) {
                printk("mxb: tea6420 i2c module not available.\n");
                return -ENODEV;
@@ -176,6 +194,10 @@ static int mxb_probe(struct saa7146_dev* dev)
                printk("mxb: tda9840 i2c module not available.\n");
                return -ENODEV;
        }
+       if ((result = request_module("tuner")) < 0) {
+               printk("mxb: tuner i2c module not available.\n");
+               return -ENODEV;
+       }
 
        mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
        if( NULL == mxb ) {
@@ -196,21 +218,7 @@ static int mxb_probe(struct saa7146_dev* dev)
        }
 
        /* loop through all i2c-devices on the bus and look who is there */
-       list_for_each(item,&mxb->i2c_adapter.clients) {
-               client = list_entry(item, struct i2c_client, list);
-               if( I2C_TEA6420_1 == client->addr )
-                       mxb->tea6420_1 = client;
-               if( I2C_TEA6420_2 == client->addr )
-                       mxb->tea6420_2 = client;
-               if( I2C_TEA6415C_2 == client->addr )
-                       mxb->tea6415c = client;
-               if( I2C_TDA9840 == client->addr )
-                       mxb->tda9840 = client;
-               if( I2C_SAA7111 == client->addr )
-                       mxb->saa7111a = client;
-               if( 0x60 == client->addr )
-                       mxb->tuner = client;
-       }
+       device_for_each_child(&mxb->i2c_adapter.dev, mxb, mxb_check_clients);
 
        /* check if all devices are present */
        if(    0 == mxb->tea6420_1      || 0 == mxb->tea6420_2  || 0 == mxb->tea6415c
@@ -790,6 +798,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
                                DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n"));
                                break;
                        }
+                       case V4L2_TUNER_MODE_LANG1_LANG2: {
+                               mxb->cur_mode = V4L2_TUNER_MODE_LANG1_LANG2;
+                               byte = TDA9840_SET_BOTH;
+                               DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n"));
+                               break;
+                       }
                        case V4L2_TUNER_MODE_LANG1: {
                                mxb->cur_mode = V4L2_TUNER_MODE_LANG1;
                                byte = TDA9840_SET_LANG1;
This page took 0.027568 seconds and 5 git commands to generate.