]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (6465): Use correct error codes when chip is not recognized
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 16 Sep 2007 13:47:15 +0000 (10:47 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:01:27 +0000 (19:01 -0200)
If the chip isn't recognized, then the correct errors should be returned.
The v4l2_i2c_attach() utility function will return 0 for all errors
except -ENOMEM to provide proper compatibility support for the old I2C
probing function.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cs53l32a.c
drivers/media/video/cx25840/cx25840-core.c
drivers/media/video/msp3400-driver.c
drivers/media/video/saa7115.c
drivers/media/video/saa7127.c
drivers/media/video/tlv320aic23b.c
drivers/media/video/upd64031a.c
drivers/media/video/upd64083.c
drivers/media/video/v4l2-common.c
drivers/media/video/vp27smpx.c
drivers/media/video/wm8739.c

index e43febb9d16136f8d43ae47bc5230a9247bb6b5f..65bb6afd8df7e578582ff3fab5c45106bd09a2ba 100644 (file)
@@ -140,7 +140,7 @@ static int cs53l32a_probe(struct i2c_client *client)
 
        /* Check if the adapter supports the needed features */
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
+               return -EIO;
 
        snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");
 
index 1556e2fad4c11a50883eb31cdd23117e80447517..6d2ca822a638cbfc713fa7a2850b348c61b5652c 100644 (file)
@@ -1078,6 +1078,10 @@ static int cx25840_probe(struct i2c_client *client)
        u32 id;
        u16 device_id;
 
+       /* Check if the adapter supports the needed features */
+       if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+               return -EIO;
+
        v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", client->addr << 1);
 
        device_id = cx25840_read(client, 0x101) << 8;
@@ -1093,7 +1097,7 @@ static int cx25840_probe(struct i2c_client *client)
        }
        else {
                v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n");
-               return 0;
+               return -ENODEV;
        }
 
        state = kzalloc(sizeof(struct cx25840_state), GFP_KERNEL);
index f2946aca129925d5cdb50279704dcf3bcae2767f..f4c14604b0b9c855851e38af460a343a63a49ab2 100644 (file)
@@ -812,7 +812,7 @@ static int msp_probe(struct i2c_client *client)
 
        if (msp_reset(client) == -1) {
                v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
-               return 0;
+               return -ENODEV;
        }
 
        state = kzalloc(sizeof(*state), GFP_KERNEL);
@@ -844,7 +844,7 @@ static int msp_probe(struct i2c_client *client)
        if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) {
                v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n");
                kfree(state);
-               return 0;
+               return -ENODEV;
        }
 
        msp_set_audio(client);
index ad60335544ff6935176d869a8a5277535a3f5b48..41e5e518a47e21926245fc8deca0d115f2edf8dc 100644 (file)
@@ -1459,7 +1459,7 @@ static int saa7115_probe(struct i2c_client *client)
 
        /* Check if the adapter supports the needed features */
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
+               return -EIO;
 
        snprintf(client->name, sizeof(client->name) - 1, "saa7115");
 
@@ -1478,7 +1478,7 @@ static int saa7115_probe(struct i2c_client *client)
        if (memcmp(name, "1f711", 5)) {
                v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n",
                        client->addr << 1, name);
-               return 0;
+               return -ENODEV;
        }
 
        snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id);
index 958ecc7168c38c86b9fe36541bb22a036ac7ab43..0262acde0888dcc446ebc39fa2a0b9e7880e9bdb 100644 (file)
@@ -671,7 +671,7 @@ static int saa7127_probe(struct i2c_client *client)
 
        /* Check if the adapter supports the needed features */
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
+               return -EIO;
 
        snprintf(client->name, sizeof(client->name) - 1, "saa7127");
 
@@ -685,12 +685,12 @@ static int saa7127_probe(struct i2c_client *client)
        if ((saa7127_read(client, 0) & 0xe4) != 0 ||
                        (saa7127_read(client, 0x29) & 0x3f) != 0x1d) {
                v4l_dbg(1, debug, client, "saa7127 not found\n");
-               return 0;
+               return -ENODEV;
        }
        state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL);
 
        if (state == NULL) {
-               return (-ENOMEM);
+               return -ENOMEM;
        }
 
        i2c_set_clientdata(client, state);
index 0282f385bbdfe363f317940b3c8b9b128241ad48..e906528348a9a276149f3eb9509cf8b236de8f2e 100644 (file)
@@ -133,7 +133,7 @@ static int tlv320aic23b_probe(struct i2c_client *client)
 
        /* Check if the adapter supports the needed features */
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
+               return -EIO;
 
        v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
 
index b060ce34071c9aab66b879879b11260f57bdd063..0318432d85f8f51057a094c228e58ea3e49fc62b 100644 (file)
@@ -200,7 +200,7 @@ static int upd64031a_probe(struct i2c_client *client)
        int i;
 
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
+               return -EIO;
 
        v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
 
index 08d2d643c65e9ceae848c6a62fc65ce17e150f83..7e32c5b0c29d03d12ccf4fc89588d9193b8c3b1c 100644 (file)
@@ -178,7 +178,7 @@ static int upd64083_probe(struct i2c_client *client)
        int i;
 
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
+               return -EIO;
 
        v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
 
index 32607a612b1836310e9f3710ec03fb357b7c2757..61ebdb0afa12f54373c5b254e0b21696841b46e8 100644 (file)
@@ -1037,7 +1037,7 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver
        else {
                kfree(client);
        }
-       return err;
+       return err != -ENOMEM ? 0 : err;
 }
 
 /* ----------------------------------------------------------------- */
index 24a942315042983c32123416263ce00674a9c379..97e24769e65b22ebb2a84beb3d37c65c77ec2dec 100644 (file)
@@ -131,7 +131,7 @@ static int vp27smpx_probe(struct i2c_client *client)
 
        /* Check if the adapter supports the needed features */
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
+               return -EIO;
 
        snprintf(client->name, sizeof(client->name) - 1, "vp27smpx");
 
index 459228a5cf50bce9bcd4a8c0bf1b6d2679db802d..3d9e709833c5d5357a5fbb1be8df6960699b1957 100644 (file)
@@ -264,6 +264,10 @@ static int wm8739_probe(struct i2c_client *client)
 {
        struct wm8739_state *state;
 
+       /* Check if the adapter supports the needed features */
+       if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+               return -EIO;
+
        v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
 
        state = kmalloc(sizeof(struct wm8739_state), GFP_KERNEL);