diff options
author | Barry Grussling <barry@grussling.com> | 2013-01-08 16:05:54 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-10 00:04:34 -0800 |
commit | 19b2f97e468b74a8aedb4e5918bccaa5702e0742 (patch) | |
tree | 2e804fa37858f9b8c0472791f5b8337c07ca636d /drivers/net/dsa/mv88e6060.c | |
parent | 3675c8d7144e91d9a2a1f6f12e576cb92e06f352 (diff) |
DSA: Convert repeated msleep calls to timeouts
Convert DSA msleep calls to timeout/usleep_range calls
as reported by checkpatch.pl.
Signed-off-by: Barry Grussling <barry@grussling.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6060.c')
-rw-r--r-- | drivers/net/dsa/mv88e6060.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c index 637373cebf7..8548f8d9f75 100644 --- a/drivers/net/dsa/mv88e6060.c +++ b/drivers/net/dsa/mv88e6060.c @@ -8,6 +8,8 @@ * (at your option) any later version. */ +#include <linux/delay.h> +#include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> @@ -66,6 +68,7 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds) { int i; int ret; + unsigned long timeout; /* Set all ports to the disabled state. */ for (i = 0; i < 6; i++) { @@ -74,20 +77,21 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds) } /* Wait for transmit queues to drain. */ - msleep(2); + usleep_range(2000, 4000); /* Reset the switch. */ REG_WRITE(REG_GLOBAL, 0x0a, 0xa130); /* Wait up to one second for reset to complete. */ - for (i = 0; i < 1000; i++) { + timeout = jiffies + 1 * HZ; + while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); if ((ret & 0x8000) == 0x0000) break; - msleep(1); + usleep_range(1000, 2000); } - if (i == 1000) + if (time_after(jiffies, timeout)) return -ETIMEDOUT; return 0; |