Message ID | 1236188005-14065-2-git-send-email-steve.glendinning@smsc.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Steve Glendinning <steve.glendinning@smsc.com> Date: Wed, 4 Mar 2009 17:33:25 +0000 > This patch from Juha Leppanen suppresses a false warning if the eeprom > load succeeds on the very last attempt. > > Juha> In function smsc911x_open smsc911x_reg_read+udelay can be run 50 > Juha> times with timeout reaching -1, and the following if statetement > Juha> does not catch the timeout and no warning is issued. Also if the > Juha> 50th smsc911x_reg_read is GOOD, loop is exited with timeout as 0 > Juha> and bogus warning issued. Replace testing order and --timeout > Juha> instead of timeout-- and now max 50 smsc911x_reg_read's are done, > Juha> with max 49 udelays. > > Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> Applied to net-next-2.6 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index 9a79510..ad15aab 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c @@ -1162,8 +1162,8 @@ static int smsc911x_open(struct net_device *dev) /* Make sure EEPROM has finished loading before setting GPIO_CFG */ timeout = 50; - while ((timeout--) && - (smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_)) { + while ((smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) && + --timeout) { udelay(10); }
This patch from Juha Leppanen suppresses a false warning if the eeprom load succeeds on the very last attempt. Juha> In function smsc911x_open smsc911x_reg_read+udelay can be run 50 Juha> times with timeout reaching -1, and the following if statetement Juha> does not catch the timeout and no warning is issued. Also if the Juha> 50th smsc911x_reg_read is GOOD, loop is exited with timeout as 0 Juha> and bogus warning issued. Replace testing order and --timeout Juha> instead of timeout-- and now max 50 smsc911x_reg_read's are done, Juha> with max 49 udelays. Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> --- drivers/net/smsc911x.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)