aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/smsc911x.c
diff options
context:
space:
mode:
authorSteve Glendinning <steve.glendinning@smsc.com>2009-03-04 02:33:25 -0500
committerDavid S. Miller <davem@davemloft.net>2009-03-13 15:14:11 -0400
commitf7efb6ccc2113911e4e064f78bcd0343c4673038 (patch)
tree3856f2a8ffa3ac0efc6da507b194f93183b2b0d6 /drivers/net/smsc911x.c
parent8dacd548129d03e87751f75ea83b42a8a17ee651 (diff)
smsc911x: improve EEPROM loading timeout logic in open
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/smsc911x.c')
-rw-r--r--drivers/net/smsc911x.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 9a795105cc7..ad15aab2137 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -1162,8 +1162,8 @@ static int smsc911x_open(struct net_device *dev)
1162 1162
1163 /* Make sure EEPROM has finished loading before setting GPIO_CFG */ 1163 /* Make sure EEPROM has finished loading before setting GPIO_CFG */
1164 timeout = 50; 1164 timeout = 50;
1165 while ((timeout--) && 1165 while ((smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) &&
1166 (smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_)) { 1166 --timeout) {
1167 udelay(10); 1167 udelay(10);
1168 } 1168 }
1169 1169