diff options
author | Barry Grussling <barry@grussling.com> | 2013-01-08 11:05:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-10 03:04:34 -0500 |
commit | 19b2f97e468b74a8aedb4e5918bccaa5702e0742 (patch) | |
tree | 2e804fa37858f9b8c0472791f5b8337c07ca636d /drivers/net/dsa/mv88e6131.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/mv88e6131.c')
-rw-r--r-- | drivers/net/dsa/mv88e6131.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c index b61381887587..dadfafba64e9 100644 --- a/drivers/net/dsa/mv88e6131.c +++ b/drivers/net/dsa/mv88e6131.c | |||
@@ -8,6 +8,8 @@ | |||
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/delay.h> | ||
12 | #include <linux/jiffies.h> | ||
11 | #include <linux/list.h> | 13 | #include <linux/list.h> |
12 | #include <linux/module.h> | 14 | #include <linux/module.h> |
13 | #include <linux/netdevice.h> | 15 | #include <linux/netdevice.h> |
@@ -42,6 +44,7 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds) | |||
42 | { | 44 | { |
43 | int i; | 45 | int i; |
44 | int ret; | 46 | int ret; |
47 | unsigned long timeout; | ||
45 | 48 | ||
46 | /* Set all ports to the disabled state. */ | 49 | /* Set all ports to the disabled state. */ |
47 | for (i = 0; i < 11; i++) { | 50 | for (i = 0; i < 11; i++) { |
@@ -50,20 +53,21 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds) | |||
50 | } | 53 | } |
51 | 54 | ||
52 | /* Wait for transmit queues to drain. */ | 55 | /* Wait for transmit queues to drain. */ |
53 | msleep(2); | 56 | usleep_range(2000, 4000); |
54 | 57 | ||
55 | /* Reset the switch. */ | 58 | /* Reset the switch. */ |
56 | REG_WRITE(REG_GLOBAL, 0x04, 0xc400); | 59 | REG_WRITE(REG_GLOBAL, 0x04, 0xc400); |
57 | 60 | ||
58 | /* Wait up to one second for reset to complete. */ | 61 | /* Wait up to one second for reset to complete. */ |
59 | for (i = 0; i < 1000; i++) { | 62 | timeout = jiffies + 1 * HZ; |
63 | while (time_before(jiffies, timeout)) { | ||
60 | ret = REG_READ(REG_GLOBAL, 0x00); | 64 | ret = REG_READ(REG_GLOBAL, 0x00); |
61 | if ((ret & 0xc800) == 0xc800) | 65 | if ((ret & 0xc800) == 0xc800) |
62 | break; | 66 | break; |
63 | 67 | ||
64 | msleep(1); | 68 | usleep_range(1000, 2000); |
65 | } | 69 | } |
66 | if (i == 1000) | 70 | if (time_after(jiffies, timeout)) |
67 | return -ETIMEDOUT; | 71 | return -ETIMEDOUT; |
68 | 72 | ||
69 | return 0; | 73 | return 0; |