aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-30 14:45:00 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-05-14 01:53:58 -0400
commitb538d28c2e326ed226096408dce4d9469d7ffa39 (patch)
tree10ec81016de1f846479d6450bc5c9f10aa4bffcc /drivers
parent09fee5f8211fc0a586187c4a0db7f5f42a4e333f (diff)
V4L/DVB (7804): tea5767: Fix error logic
As pointed by Andrew Morton, the error testing were wrong. After reviewing tea5767, it were returning a positive value for errors. So, the double errors were cancelling each other. This patch fix it properly. It also considers any positive value as ok, on tuner-core. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/common/tuners/tea5767.c6
-rw-r--r--drivers/media/video/tuner-core.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/common/tuners/tea5767.c b/drivers/media/common/tuners/tea5767.c
index f6e7d7ad8424..1f5646334a8f 100644
--- a/drivers/media/common/tuners/tea5767.c
+++ b/drivers/media/common/tuners/tea5767.c
@@ -373,14 +373,14 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
373 373
374 if ((rc = tuner_i2c_xfer_recv(&i2c, buffer, 7))< 5) { 374 if ((rc = tuner_i2c_xfer_recv(&i2c, buffer, 7))< 5) {
375 printk(KERN_WARNING "It is not a TEA5767. Received %i bytes.\n", rc); 375 printk(KERN_WARNING "It is not a TEA5767. Received %i bytes.\n", rc);
376 return EINVAL; 376 return -EINVAL;
377 } 377 }
378 378
379 /* If all bytes are the same then it's a TV tuner and not a tea5767 */ 379 /* If all bytes are the same then it's a TV tuner and not a tea5767 */
380 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && 380 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
381 buffer[0] == buffer[3] && buffer[0] == buffer[4]) { 381 buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
382 printk(KERN_WARNING "All bytes are equal. It is not a TEA5767\n"); 382 printk(KERN_WARNING "All bytes are equal. It is not a TEA5767\n");
383 return EINVAL; 383 return -EINVAL;
384 } 384 }
385 385
386 /* Status bytes: 386 /* Status bytes:
@@ -390,7 +390,7 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
390 */ 390 */
391 if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) { 391 if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) {
392 printk(KERN_WARNING "Chip ID is not zero. It is not a TEA5767\n"); 392 printk(KERN_WARNING "Chip ID is not zero. It is not a TEA5767\n");
393 return EINVAL; 393 return -EINVAL;
394 } 394 }
395 395
396 396
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index b5dacde023ee..4ca686fad557 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1165,7 +1165,7 @@ static int tuner_probe(struct i2c_client *client,
1165 /* If chip is not tda8290, don't register. 1165 /* If chip is not tda8290, don't register.
1166 since it can be tda9887*/ 1166 since it can be tda9887*/
1167 if (tuner_symbol_probe(tda829x_probe, t->i2c->adapter, 1167 if (tuner_symbol_probe(tda829x_probe, t->i2c->adapter,
1168 t->i2c->addr) == 0) { 1168 t->i2c->addr) >= 0) {
1169 tuner_dbg("tda829x detected\n"); 1169 tuner_dbg("tda829x detected\n");
1170 } else { 1170 } else {
1171 /* Default is being tda9887 */ 1171 /* Default is being tda9887 */
@@ -1179,7 +1179,7 @@ static int tuner_probe(struct i2c_client *client,
1179 case 0x60: 1179 case 0x60:
1180 if (tuner_symbol_probe(tea5767_autodetection, 1180 if (tuner_symbol_probe(tea5767_autodetection,
1181 t->i2c->adapter, t->i2c->addr) 1181 t->i2c->adapter, t->i2c->addr)
1182 != EINVAL) { 1182 >= 0) {
1183 t->type = TUNER_TEA5767; 1183 t->type = TUNER_TEA5767;
1184 t->mode_mask = T_RADIO; 1184 t->mode_mask = T_RADIO;
1185 t->mode = T_STANDBY; 1185 t->mode = T_STANDBY;