Skip to content

Commit

Permalink
smsc911x: improve EEPROM loading timeout logic in open
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steve Glendinning authored and David S. Miller committed Mar 13, 2009
1 parent 8dacd54 commit f7efb6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit f7efb6c

Please sign in to comment.