[U-Boot] redundant code in common/cmd_i2c.

The following code fragment in the file common/cmd_i2c.c seems to be redundant. Is not good to delete ?
Line 330 - 336 is like below
#if 0 for (timeout = 0; timeout < 10; timeout++) { udelay(2000); if (i2c_probe(chip) == 0) break; } #endif
Regards Pratap Chandu Indian Institute of Tecnology , Roorkee

Hello PratapChandu,
PratapChandu wrote:
The following code fragment in the file common/cmd_i2c.c seems to be redundant. Is not good to delete ?
Line 330 - 336 is like below
#if 0 for (timeout = 0; timeout < 10; timeout++) { udelay(2000); if (i2c_probe(chip) == 0) break; } #endif
Yes, this seems to be dead code. Please provide a patch for removing it.
Thanks.
bye Heiko

Hi Heiko,
Hello PratapChandu,
PratapChandu wrote:
The following code fragment in the file common/cmd_i2c.c seems to be redundant. Is not good to delete ?
Line 330 - 336 is like below
#if 0 for (timeout = 0; timeout < 10; timeout++) { udelay(2000); if (i2c_probe(chip) == 0) break; } #endif
Yes, this seems to be dead code. Please provide a patch for removing it.
Ah uh, check the comment above which is directly related to this piece of code. if you remove only the code, you have a dangling comment. Maybe this was meant to be an option but nobody cared to make it optional?
Actually I do not know if this was ever used, but we should try to do the change consistently.
Cheers Detlev

Hello Detlev,
Detlev Zundel wrote:
Hello PratapChandu,
PratapChandu wrote:
The following code fragment in the file common/cmd_i2c.c seems to be redundant. Is not good to delete ?
Line 330 - 336 is like below
#if 0 for (timeout = 0; timeout < 10; timeout++) { udelay(2000); if (i2c_probe(chip) == 0) break; } #endif
Yes, this seems to be dead code. Please provide a patch for removing it.
Ah uh, check the comment above which is directly related to this piece of code. if you remove only the code, you have a dangling comment. Maybe this was meant to be an option but nobody cared to make it optional?
Yep, you are right, a patch schould fix the comment too, or (maybe better?) make this as an option configurable ...
Actually I do not know if this was ever used, but we should try to do the change consistently.
Yep.
Thanks for detecting this!
bye Heiko
participants (3)
-
Detlev Zundel
-
Heiko Schocher
-
PratapChandu