]> git.baikalelectronics.ru Git - kernel.git/commit
dsa: mv88e6xxx: Timeout based on iterations, not time
authorAndrew Lunn <andrew@lunn.ch>
Thu, 18 Aug 2016 22:01:55 +0000 (00:01 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 20 Aug 2016 00:14:07 +0000 (17:14 -0700)
commit345bd040c82f85a990a9c55b736eb863b9eb22f6
tree6176d51df774454eb72af38c718cc4acb1f7f85b
parent01737e99cadf4677197ad6f558d71bdf7aac1083
dsa: mv88e6xxx: Timeout based on iterations, not time

The mv88e6xxx driver times out operations on the switch based on
looping until an elapsed wall clock time is reached. However, if
usleep_range() sleeps much longer than expected, it could timeout with
an error without actually checking to see if the devices has completed
the operation. So replace the elapsed time with a fixed upper bound on
the number of loops.

Testing on various switches has shown that switches takes either 0 or
1 iteration, so a maximum of 16 iterations is a safe limit.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/chip.c