aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-09-16 09:47:15 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:01:27 -0500
commit188f3457c21ac7869005021b56b4578293c644bb (patch)
tree7002562a01698d2fa6070f1547e609f9b29cb163 /drivers
parent6235168db8ed96c587e566be0dd72a77ca212693 (diff)
V4L/DVB (6465): Use correct error codes when chip is not recognized
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cs53l32a.c2
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c6
-rw-r--r--drivers/media/video/msp3400-driver.c4
-rw-r--r--drivers/media/video/saa7115.c4
-rw-r--r--drivers/media/video/saa7127.c6
-rw-r--r--drivers/media/video/tlv320aic23b.c2
-rw-r--r--drivers/media/video/upd64031a.c2
-rw-r--r--drivers/media/video/upd64083.c2
-rw-r--r--drivers/media/video/v4l2-common.c2
-rw-r--r--drivers/media/video/vp27smpx.c2
-rw-r--r--drivers/media/video/wm8739.c4
11 files changed, 22 insertions, 14 deletions
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c
index e43febb9d16..65bb6afd8df 100644
--- a/drivers/media/video/cs53l32a.c
+++ b/drivers/media/video/cs53l32a.c
@@ -140,7 +140,7 @@ static int cs53l32a_probe(struct i2c_client *client)
140 140
141 /* Check if the adapter supports the needed features */ 141 /* Check if the adapter supports the needed features */
142 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 142 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
143 return 0; 143 return -EIO;
144 144
145 snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); 145 snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");
146 146
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 1556e2fad4c..6d2ca822a63 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1078,6 +1078,10 @@ static int cx25840_probe(struct i2c_client *client)
1078 u32 id; 1078 u32 id;
1079 u16 device_id; 1079 u16 device_id;
1080 1080
1081 /* Check if the adapter supports the needed features */
1082 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1083 return -EIO;
1084
1081 v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", client->addr << 1); 1085 v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", client->addr << 1);
1082 1086
1083 device_id = cx25840_read(client, 0x101) << 8; 1087 device_id = cx25840_read(client, 0x101) << 8;
@@ -1093,7 +1097,7 @@ static int cx25840_probe(struct i2c_client *client)
1093 } 1097 }
1094 else { 1098 else {
1095 v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n"); 1099 v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n");
1096 return 0; 1100 return -ENODEV;
1097 } 1101 }
1098 1102
1099 state = kzalloc(sizeof(struct cx25840_state), GFP_KERNEL); 1103 state = kzalloc(sizeof(struct cx25840_state), GFP_KERNEL);
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index f2946aca129..f4c14604b0b 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -812,7 +812,7 @@ static int msp_probe(struct i2c_client *client)
812 812
813 if (msp_reset(client) == -1) { 813 if (msp_reset(client) == -1) {
814 v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); 814 v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
815 return 0; 815 return -ENODEV;
816 } 816 }
817 817
818 state = kzalloc(sizeof(*state), GFP_KERNEL); 818 state = kzalloc(sizeof(*state), GFP_KERNEL);
@@ -844,7 +844,7 @@ static int msp_probe(struct i2c_client *client)
844 if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) { 844 if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) {
845 v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n"); 845 v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n");
846 kfree(state); 846 kfree(state);
847 return 0; 847 return -ENODEV;
848 } 848 }
849 849
850 msp_set_audio(client); 850 msp_set_audio(client);
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index ad60335544f..41e5e518a47 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1459,7 +1459,7 @@ static int saa7115_probe(struct i2c_client *client)
1459 1459
1460 /* Check if the adapter supports the needed features */ 1460 /* Check if the adapter supports the needed features */
1461 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 1461 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1462 return 0; 1462 return -EIO;
1463 1463
1464 snprintf(client->name, sizeof(client->name) - 1, "saa7115"); 1464 snprintf(client->name, sizeof(client->name) - 1, "saa7115");
1465 1465
@@ -1478,7 +1478,7 @@ static int saa7115_probe(struct i2c_client *client)
1478 if (memcmp(name, "1f711", 5)) { 1478 if (memcmp(name, "1f711", 5)) {
1479 v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n", 1479 v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n",
1480 client->addr << 1, name); 1480 client->addr << 1, name);
1481 return 0; 1481 return -ENODEV;
1482 } 1482 }
1483 1483
1484 snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); 1484 snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id);
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index 958ecc7168c..0262acde088 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -671,7 +671,7 @@ static int saa7127_probe(struct i2c_client *client)
671 671
672 /* Check if the adapter supports the needed features */ 672 /* Check if the adapter supports the needed features */
673 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 673 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
674 return 0; 674 return -EIO;
675 675
676 snprintf(client->name, sizeof(client->name) - 1, "saa7127"); 676 snprintf(client->name, sizeof(client->name) - 1, "saa7127");
677 677
@@ -685,12 +685,12 @@ static int saa7127_probe(struct i2c_client *client)
685 if ((saa7127_read(client, 0) & 0xe4) != 0 || 685 if ((saa7127_read(client, 0) & 0xe4) != 0 ||
686 (saa7127_read(client, 0x29) & 0x3f) != 0x1d) { 686 (saa7127_read(client, 0x29) & 0x3f) != 0x1d) {
687 v4l_dbg(1, debug, client, "saa7127 not found\n"); 687 v4l_dbg(1, debug, client, "saa7127 not found\n");
688 return 0; 688 return -ENODEV;
689 } 689 }
690 state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL); 690 state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL);
691 691
692 if (state == NULL) { 692 if (state == NULL) {
693 return (-ENOMEM); 693 return -ENOMEM;
694 } 694 }
695 695
696 i2c_set_clientdata(client, state); 696 i2c_set_clientdata(client, state);
diff --git a/drivers/media/video/tlv320aic23b.c b/drivers/media/video/tlv320aic23b.c
index 0282f385bbd..e906528348a 100644
--- a/drivers/media/video/tlv320aic23b.c
+++ b/drivers/media/video/tlv320aic23b.c
@@ -133,7 +133,7 @@ static int tlv320aic23b_probe(struct i2c_client *client)
133 133
134 /* Check if the adapter supports the needed features */ 134 /* Check if the adapter supports the needed features */
135 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 135 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
136 return 0; 136 return -EIO;
137 137
138 v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); 138 v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
139 139
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c
index b060ce34071..0318432d85f 100644
--- a/drivers/media/video/upd64031a.c
+++ b/drivers/media/video/upd64031a.c
@@ -200,7 +200,7 @@ static int upd64031a_probe(struct i2c_client *client)
200 int i; 200 int i;
201 201
202 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 202 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
203 return 0; 203 return -EIO;
204 204
205 v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); 205 v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
206 206
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c
index 08d2d643c65..7e32c5b0c29 100644
--- a/drivers/media/video/upd64083.c
+++ b/drivers/media/video/upd64083.c
@@ -178,7 +178,7 @@ static int upd64083_probe(struct i2c_client *client)
178 int i; 178 int i;
179 179
180 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 180 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
181 return 0; 181 return -EIO;
182 182
183 v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); 183 v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
184 184
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 32607a612b1..61ebdb0afa1 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -1037,7 +1037,7 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver
1037 else { 1037 else {
1038 kfree(client); 1038 kfree(client);
1039 } 1039 }
1040 return err; 1040 return err != -ENOMEM ? 0 : err;
1041} 1041}
1042 1042
1043/* ----------------------------------------------------------------- */ 1043/* ----------------------------------------------------------------- */
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c
index 24a94231504..97e24769e65 100644
--- a/drivers/media/video/vp27smpx.c
+++ b/drivers/media/video/vp27smpx.c
@@ -131,7 +131,7 @@ static int vp27smpx_probe(struct i2c_client *client)
131 131
132 /* Check if the adapter supports the needed features */ 132 /* Check if the adapter supports the needed features */
133 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 133 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
134 return 0; 134 return -EIO;
135 135
136 snprintf(client->name, sizeof(client->name) - 1, "vp27smpx"); 136 snprintf(client->name, sizeof(client->name) - 1, "vp27smpx");
137 137
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c
index 459228a5cf5..3d9e709833c 100644
--- a/drivers/media/video/wm8739.c
+++ b/drivers/media/video/wm8739.c
@@ -264,6 +264,10 @@ static int wm8739_probe(struct i2c_client *client)
264{ 264{
265 struct wm8739_state *state; 265 struct wm8739_state *state;
266 266
267 /* Check if the adapter supports the needed features */
268 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
269 return -EIO;
270
267 v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); 271 v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
268 272
269 state = kmalloc(sizeof(struct wm8739_state), GFP_KERNEL); 273 state = kmalloc(sizeof(struct wm8739_state), GFP_KERNEL);