netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Barry Grussling <barry@grussling.com>
To: barry@grussling.com, netdev@vger.kernel.org
Subject: [PATCH 2/4] DSA: Convert msleep calls to usleep_range calls
Date: Wed,  2 Jan 2013 17:54:56 -0800	[thread overview]
Message-ID: <1357178098-4057-3-git-send-email-barry@grussling.com> (raw)
In-Reply-To: <1357178098-4057-1-git-send-email-barry@grussling.com>

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@grussling.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

  parent reply	other threads:[~2013-01-03  1:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-03  1:54 [PATCH 0/4] DSA: Fix checkpatch.pl output for DSA drivers Barry Grussling
2013-01-03  1:54 ` [PATCH 1/4] DSA: Convert DSA driver comments to network-style comments Barry Grussling
2013-01-03  2:05   ` Joe Perches
2013-01-03  1:54 ` Barry Grussling [this message]
2013-01-03 20:14   ` [PATCH 2/4] DSA: Convert msleep calls to usleep_range calls Ben Hutchings
2013-01-03 22:33     ` Barry Grussling
2013-01-03 22:56       ` Ben Hutchings
2013-01-03  1:54 ` [PATCH 3/4] DSA: Convert printk calls to netdev_info calls Barry Grussling
2013-01-03 19:06   ` Joe Perches
2013-01-03  1:54 ` [PATCH 4/4] DSA: Convert spaces to tabs where appropriate Barry Grussling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357178098-4057-3-git-send-email-barry@grussling.com \
    --to=barry@grussling.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).