The patch number 8029 was added via Mauro Carvalho Chehab <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
Improve error message at tda1004x_attach



When an error occurs at firmware loading, sometimes, tda1004x stops answering.
Instead of reporting such error, attach code were assuming that the device were
answering an invalid ID (0xff). This can be seen when enabling debug options:

tda1004x: tda1004x_read_byte: reg=0x0
tda1004x: tda1004x_read_byte: error reg=0x0, ret=-5

Now, instead of reporting an invalid ID, it will report the correct error:

tda10046: chip is not answering. Giving up.
saa7133[0]/dvb: failed to attach tda10046
saa7133[0]/dvb: frontend initialization failed

A possible improvement would be trying to reset the device.

Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 linux/drivers/media/dvb/frontends/tda1004x.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff -r ff08424ce120 -r 000ffc33cb89 
linux/drivers/media/dvb/frontends/tda1004x.c
--- a/linux/drivers/media/dvb/frontends/tda1004x.c      Sat Jun 14 07:44:04 
2008 -0300
+++ b/linux/drivers/media/dvb/frontends/tda1004x.c      Sat Jun 14 08:27:34 
2008 -0300
@@ -1248,7 +1248,7 @@ struct dvb_frontend* tda10045_attach(con
                                     struct i2c_adapter* i2c)
 {
        struct tda1004x_state *state;
-       u8 id;
+       int id;
 
        /* allocate memory for the internal state */
        state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL);
@@ -1264,6 +1264,12 @@ struct dvb_frontend* tda10045_attach(con
 
        /* check if the demod is there */
        id = tda1004x_read_byte(state, TDA1004X_CHIPID);
+       if (id < 0) {
+               printk(KERN_ERR "tda10045: chip is not answering. Giving 
up.\n");
+               kfree(state);
+               return NULL;
+       }
+
        if (id != 0x25) {
                printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't 
proceed\n", id);
                kfree(state);
@@ -1312,7 +1318,7 @@ struct dvb_frontend* tda10046_attach(con
                                     struct i2c_adapter* i2c)
 {
        struct tda1004x_state *state;
-       u8 id;
+       int id;
 
        /* allocate memory for the internal state */
        state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL);
@@ -1328,6 +1334,11 @@ struct dvb_frontend* tda10046_attach(con
 
        /* check if the demod is there */
        id = tda1004x_read_byte(state, TDA1004X_CHIPID);
+       if (id < 0) {
+               printk(KERN_ERR "tda10046: chip is not answering. Giving 
up.\n");
+               kfree(state);
+               return NULL;
+       }
        if (id != 0x46) {
                printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't 
proceed\n", id);
                kfree(state);


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/000ffc33cb8903713d46d53bacf9e8dfb5833415

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to