V4L/DVB (7728): tea5761: bugzilla #10462: tea5761 autodetection code were broken
authorMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 23 Apr 2008 20:27:27 +0000 (17:27 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:09:50 +0000 (14:09 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/tea5761.c
drivers/media/video/tuner-core.c

index bd5ad549c1df6d1380ffea6ab90fee376ad27243..b93cdef9ac73e48b04f5a369da3767e6d46c42d7 100644 (file)
@@ -247,14 +247,19 @@ int tea5761_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
 
        if (16 != (rc = tuner_i2c_xfer_recv(&i2c, buffer, 16))) {
                printk(KERN_WARNING "it is not a TEA5761. Received %i chars.\n", rc);
-               return EINVAL;
+               return -EINVAL;
        }
 
-       if (!((buffer[13] != 0x2b) || (buffer[14] != 0x57) || (buffer[15] != 0x061))) {
-               printk(KERN_WARNING "Manufacturer ID= 0x%02x, Chip ID = %02x%02x. It is not a TEA5761\n",buffer[13],buffer[14],buffer[15]);
-               return EINVAL;
+       if ((buffer[13] != 0x2b) || (buffer[14] != 0x57) || (buffer[15] != 0x061)) {
+               printk(KERN_WARNING "Manufacturer ID= 0x%02x, Chip ID = %02x%02x."
+                                   " It is not a TEA5761\n",
+                                   buffer[13], buffer[14], buffer[15]);
+               return -EINVAL;
        }
-       printk(KERN_WARNING "TEA5761 detected.\n");
+       printk(KERN_WARNING "tea5761: TEA%02x%02x detected. "
+                           "Manufacturer ID= 0x%02x\n",
+                           buffer[14], buffer[15], buffer[13]);
+
        return 0;
 }
 
index e886f48a2909d6438335751246d3679fde3c4266..529e00952a8db1c0b813f8f3ae06c1d62d067e3b 100644 (file)
@@ -1111,8 +1111,8 @@ static int tuner_probe(struct i2c_client *client)
        if (!no_autodetect) {
                switch (client->addr) {
                case 0x10:
-                       if (tea5761_autodetection(t->i2c->adapter, t->i2c->addr)
-                                       != EINVAL) {
+                       if (tea5761_autodetection(t->i2c->adapter,
+                                                 t->i2c->addr) >= 0) {
                                t->type = TUNER_TEA5761;
                                t->mode_mask = T_RADIO;
                                t->mode = T_STANDBY;
@@ -1124,7 +1124,7 @@ static int tuner_probe(struct i2c_client *client)
 
                                goto register_client;
                        }
-                       break;
+                       return -ENODEV;
                case 0x42:
                case 0x43:
                case 0x4a: