[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1357178098-4057-3-git-send-email-barry@grussling.com>
Date: Wed, 2 Jan 2013 17:54:56 -0800
From: Barry Grussling <barry@...ssling.com>
To: barry@...ssling.com, netdev@...r.kernel.org
Subject: [PATCH 2/4] DSA: Convert msleep calls to usleep_range calls
Convert DSA msleep calls to usleep_range calls as reported by
checkpatch.pl.
Values of sleep duration were verified on Marvell hardware
platform and appear to work. Values chosen are not special
and no strong "vetting" has gone into them other than verifying
correct operation on available hardware.
Signed-off-by: Barry Grussling <barry@...ssling.com>
---
drivers/net/dsa/mv88e6060.c | 7 ++++---
drivers/net/dsa/mv88e6123_61_65.c | 7 ++++---
drivers/net/dsa/mv88e6131.c | 7 ++++---
drivers/net/dsa/mv88e6xxx.c | 5 +++--
4 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 16ec763..fa6bc7d 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -8,6 +8,7 @@
* (at your option) any later version.
*/
+#include <linux/delay.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/netdevice.h>
@@ -76,20 +77,20 @@ 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.
+ /* Wait up to two seconds for reset to complete.
*/
for (i = 0; i < 1000; i++) {
ret = REG_READ(REG_GLOBAL, 0x00);
if ((ret & 0x8000) == 0x0000)
break;
- msleep(1);
+ usleep_range(1000, 2000);
}
if (i == 1000)
return -ETIMEDOUT;
diff --git a/drivers/net/dsa/mv88e6123_61_65.c b/drivers/net/dsa/mv88e6123_61_65.c
index f964bfb..0ead9b4 100644
--- a/drivers/net/dsa/mv88e6123_61_65.c
+++ b/drivers/net/dsa/mv88e6123_61_65.c
@@ -8,6 +8,7 @@
* (at your option) any later version.
*/
+#include <linux/delay.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/netdevice.h>
@@ -60,20 +61,20 @@ static int mv88e6123_61_65_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, 0x04, 0xc400);
- /* Wait up to one second for reset to complete.
+ /* Wait up to two seconds for reset to complete.
*/
for (i = 0; i < 1000; i++) {
ret = REG_READ(REG_GLOBAL, 0x00);
if ((ret & 0xc800) == 0xc800)
break;
- msleep(1);
+ usleep_range(1000, 2000);
}
if (i == 1000)
return -ETIMEDOUT;
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index 7a7bcc2..7872507 100644
--- a/drivers/net/dsa/mv88e6131.c
+++ b/drivers/net/dsa/mv88e6131.c
@@ -8,6 +8,7 @@
* (at your option) any later version.
*/
+#include <linux/delay.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/netdevice.h>
@@ -53,20 +54,20 @@ static int mv88e6131_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, 0x04, 0xc400);
- /* Wait up to one second for reset to complete.
+ /* Wait up to two seconds for reset to complete.
*/
for (i = 0; i < 1000; i++) {
ret = REG_READ(REG_GLOBAL, 0x00);
if ((ret & 0xc800) == 0xc800)
break;
- msleep(1);
+ usleep_range(1000, 2000);
}
if (i == 1000)
return -ETIMEDOUT;
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index eaa341a..a2f9e9b6 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -8,6 +8,7 @@
* (at your option) any later version.
*/
+#include <linux/delay.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/netdevice.h>
@@ -215,7 +216,7 @@ static int mv88e6xxx_ppu_disable(struct dsa_switch *ds)
for (i = 0; i < 1000; i++) {
ret = REG_READ(REG_GLOBAL, 0x00);
- msleep(1);
+ usleep_range(1000, 2000);
if ((ret & 0xc000) != 0xc000)
return 0;
}
@@ -233,7 +234,7 @@ static int mv88e6xxx_ppu_enable(struct dsa_switch *ds)
for (i = 0; i < 1000; i++) {
ret = REG_READ(REG_GLOBAL, 0x00);
- msleep(1);
+ usleep_range(1000, 2000);
if ((ret & 0xc000) == 0xc000)
return 0;
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists