]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (7804): tea5767: Fix error logic
authorMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 30 Apr 2008 18:45:00 +0000 (15:45 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 14 May 2008 05:53:58 +0000 (02:53 -0300)
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>
drivers/media/common/tuners/tea5767.c
drivers/media/video/tuner-core.c

index f6e7d7ad842416ad5ac9b82bde9532125a3ddd80..1f5646334a8ffad1cffeb6183f796abb6c65f711 100644 (file)
@@ -373,14 +373,14 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
 
        if ((rc = tuner_i2c_xfer_recv(&i2c, buffer, 7))< 5) {
                printk(KERN_WARNING "It is not a TEA5767. Received %i bytes.\n", rc);
-               return EINVAL;
+               return -EINVAL;
        }
 
        /* If all bytes are the same then it's a TV tuner and not a tea5767 */
        if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
            buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
                printk(KERN_WARNING "All bytes are equal. It is not a TEA5767\n");
-               return EINVAL;
+               return -EINVAL;
        }
 
        /*  Status bytes:
@@ -390,7 +390,7 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
         */
        if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) {
                printk(KERN_WARNING "Chip ID is not zero. It is not a TEA5767\n");
-               return EINVAL;
+               return -EINVAL;
        }
 
 
index b5dacde023ee3b9f78ebb122da399bb5c1610963..4ca686fad55786597a2e857f5d13174b2e5074c5 100644 (file)
@@ -1165,7 +1165,7 @@ static int tuner_probe(struct i2c_client *client,
                        /* If chip is not tda8290, don't register.
                           since it can be tda9887*/
                        if (tuner_symbol_probe(tda829x_probe, t->i2c->adapter,
-                                              t->i2c->addr) == 0) {
+                                              t->i2c->addr) >= 0) {
                                tuner_dbg("tda829x detected\n");
                        } else {
                                /* Default is being tda9887 */
@@ -1179,7 +1179,7 @@ static int tuner_probe(struct i2c_client *client,
                case 0x60:
                        if (tuner_symbol_probe(tea5767_autodetection,
                                               t->i2c->adapter, t->i2c->addr)
-                                       != EINVAL) {
+                                       >= 0) {
                                t->type = TUNER_TEA5767;
                                t->mode_mask = T_RADIO;
                                t->mode = T_STANDBY;