[linux-dvb] [PATCH 1/3] Fix a problem during the access to the IER and ISR registers of the SA7146

e9hack e9hack at googlemail.com
Wed Nov 1 10:00:11 CET 2006


Oliver Endriss wrote:
> e9hack wrote:
>   
>   
>>                 SAA7146_IER_ENABLE(dev, MASK_16|MASK_17);
>>                 saa7146_write(dev, MC2, (MASK_00 | MASK_16));
>>  
>> -               wait_event_interruptible(dev->i2c_wq, dev->i2c_op == 0);
>> -               if (signal_pending (current)) {
>> -                       /* a signal arrived */
>> -                       return -ERESTARTSYS;
>> +               timeout = HZ/100 + 1; /* 10ms */
>> +               timeout = wait_event_interruptible_timeout(dev->i2c_wq, dev->i2c_op == 0, timeout);
>> +               if (timeout == -ERESTARTSYS || dev->i2c_op) {
>> +                       SAA7146_IER_DISABLE(dev, MASK_16|MASK_17);
>> +                       SAA7146_ISR_CLEAR(dev, MASK_16|MASK_17);
>> +                       if (timeout == -ERESTARTSYS) {
>> +                               /* a signal arrived */
>> +                               return -ERESTARTSYS;
>> +                       }
>>     
>
> Please remove '{' and '}' - kernel coding style ;-)
>   
The original code contains also this brackets. I removed it.

>   
>> +                       /* this is normal when probing the bus
>> +                        * (no answer from nonexisistant device...)
>> +                        */
>> +                       DEB_I2C(("saa7146_i2c_writeout: timed out waiting for end of xfer\n"));
>> +                       return -EIO;
>>     
>
> Are you able to trigger this timeout? Is yes, how?
>
> Imho it cannot happen anymore (because of [1]) unless the hardware is
> broken. Even with nonexistent devices there should be an I2C irq.
>
> Anyway, it is a good idea to add this timeout protection.
>   
I didn't see such a timeout.
> If it cannot happen under normal circumstances you should replace
> DEB_I2C by printk.
>   
I changed it.

- Hartmut


-------------- next part --------------
A non-text attachment was scrubbed...
Name: saa7146-i2c-fix-3.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
Url : http://www.linuxtv.org/pipermail/linux-dvb/attachments/20061101/a0f80699/saa7146-i2c-fix-3.bin


More information about the linux-dvb mailing list