[PATCH 2/4] rts5208: Fix usleep_range is preferred over udelay

Lukas Schneider lukas.s.schneider at fau.de
Wed Jun 19 15:46:46 UTC 2019


This patch fixes the issue reported by checkpatch:

CHECK: usleep_range is preferred over udelay;
see Documentation/timers/timers-howto.txt

It's save to sleep here instead of using busy waiting,
because we are not in an atomic context.

Signed-off-by: Lukas Schneider <lukas.s.schneider at fau.de>
Signed-off-by: Jannik Moritz <jannik.moritz at fau.de>
Cc <linux-kernel at i4.cs.fau.de>
---
 drivers/staging/rts5208/rtsx_card.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_card.c b/drivers/staging/rts5208/rtsx_card.c
index 294f381518fa..960e845133c3 100644
--- a/drivers/staging/rts5208/rtsx_card.c
+++ b/drivers/staging/rts5208/rtsx_card.c
@@ -679,7 +679,7 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
 	if (retval < 0)
 		return STATUS_ERROR;
 
-	udelay(10);
+	usleep_range(10, 20);
 	retval = rtsx_write_register(chip, CLK_CTL, CLK_LOW_FREQ, 0);
 	if (retval)
 		return retval;
@@ -797,7 +797,7 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
 		return retval;
 
 	if (sd_vpclk_phase_reset) {
-		udelay(200);
+		usleep_range(200, 210);
 		retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
 					     PHASE_NOT_RESET, PHASE_NOT_RESET);
 		if (retval)
@@ -806,7 +806,7 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
 					     PHASE_NOT_RESET, PHASE_NOT_RESET);
 		if (retval)
 			return retval;
-		udelay(200);
+		usleep_range(200, 210);
 	}
 	retval = rtsx_write_register(chip, CLK_CTL, 0xFF, 0);
 	if (retval)
-- 
2.19.1



More information about the devel mailing list