diff mbox series

usb: renesas_usbhs: replace udelay() with usleep_range()

Message ID 1547709855-32749-1-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Mainlined
Commit 1c1a3ddae9782ba748f5ceb775ed13ef554e8994
Headers show
Series usb: renesas_usbhs: replace udelay() with usleep_range() | expand

Commit Message

Yoshihiro Shimoda Jan. 17, 2019, 7:24 a.m. UTC
According to Documentation/timers/timers-howto.txt, a driver should
use usleep_range() instead of udelay() on NON-ATOMIC CONTEXT if
"SLEEPING FOR ~USECS OR SMALL MSECS ( 10us - 20ms)".

Since the .hardware_init() and .power_ctrl() will run on NON-ATOMIC
CONTEXT, this patch replaces udelay() with usleep_range().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/renesas_usbhs/rcar3.c | 2 +-
 drivers/usb/renesas_usbhs/rza.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Horman Jan. 17, 2019, 10:43 a.m. UTC | #1
On Thu, Jan 17, 2019 at 04:24:15PM +0900, Yoshihiro Shimoda wrote:
> According to Documentation/timers/timers-howto.txt, a driver should
> use usleep_range() instead of udelay() on NON-ATOMIC CONTEXT if
> "SLEEPING FOR ~USECS OR SMALL MSECS ( 10us - 20ms)".
> 
> Since the .hardware_init() and .power_ctrl() will run on NON-ATOMIC
> CONTEXT, this patch replaces udelay() with usleep_range().
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
diff mbox series

Patch

diff --git a/drivers/usb/renesas_usbhs/rcar3.c b/drivers/usb/renesas_usbhs/rcar3.c
index aa38204..5e730e9 100644
--- a/drivers/usb/renesas_usbhs/rcar3.c
+++ b/drivers/usb/renesas_usbhs/rcar3.c
@@ -59,7 +59,7 @@  static int usbhs_rcar3_power_ctrl(struct platform_device *pdev,
 	if (enable) {
 		usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM);
 		/* The controller on R-Car Gen3 needs to wait up to 45 usec */
-		udelay(45);
+		usleep_range(45, 90);
 	} else {
 		usbhs_bset(priv, LPSTS, LPSTS_SUSPM, 0);
 	}
diff --git a/drivers/usb/renesas_usbhs/rza.c b/drivers/usb/renesas_usbhs/rza.c
index 5b28725..8c739bd 100644
--- a/drivers/usb/renesas_usbhs/rza.c
+++ b/drivers/usb/renesas_usbhs/rza.c
@@ -35,7 +35,7 @@  static int usbhs_rza1_hardware_init(struct platform_device *pdev)
 
 	/* Enable USB PLL (NOTE: ch0 controls both ch0 and ch1) */
 	usbhs_bset(priv, SYSCFG, UPLLE, UPLLE);
-	udelay(1000);
+	usleep_range(1000, 2000);
 	usbhs_bset(priv, SUSPMODE, SUSPM, SUSPM);
 
 	return 0;