Skip to contentSkip to conversation

staging: rts5208: ms.c: Remove two udelay calls and use usleep_range instead

PATCH In review Sebastian Luchetti 3 participants 3 messages Oct 17, 2021 – Oct 20, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rts5208: ms.c: Remove two udelay calls and use usleep_range instead

This patch fixes the issue:
CHECK: usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt
in two occurrences.

---
 drivers/staging/rts5208/ms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts5208/ms.c +2 -2
index 2a6fab5c117a..7292c8f013fd 100644
@@ -3236,7 +3236,7 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk,
 			return STATUS_FAIL;
 		}
 
-		udelay(30);
+		usleep_range(27, 32);
 
 		rtsx_init_cmd(chip);
 
@@ -4158,7 +4158,7 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 
 #ifdef MG_SET_ICV_SLOW
 	for (i = 0; i < 2; i++) {
-		udelay(50);
+		usleep_range(47, 52);
 
 		rtsx_init_cmd(chip);
 
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 15 lines · Sebastian Luchetti

This patch fixes the issue:
CHECK: usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt
in two occurrences.

---
 drivers/staging/rts5208/ms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts5208/ms.c +0 -0
index 2a6fab5c117a..7292c8f013fd 100644

drivers/staging/rts5208/ms.c static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk, · line 3239

Quoted 5 lines
drivers/staging/rts5208/ms.c +1 -1
@@ -3236,7 +3236,7 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk,
 			return STATUS_FAIL;
 		}
 
-		udelay(30);
+		usleep_range(27, 32);

These are very odd choices of a number, where did they come from?

And as the other thread on this mailing list a few hours ago describes, for this same type of change, you need to test this with the actual hardware to know if this works properly or not. Have you done so?

thanks,

greg k-h

#2 lore raw

From: Greg KH

Quoted 21 lines

Sent: 17 October 2021 14:42

Quoted 18 lines · Sebastian Luchetti

This patch fixes the issue:
CHECK: usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt
in two occurrences.

---
 drivers/staging/rts5208/ms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts5208/ms.c +0 -0
index 2a6fab5c117a..7292c8f013fd 100644
@@ -3236,7 +3236,7 @@ static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk,
 			return STATUS_FAIL;
 		}
 
Quoted 8 lines

drivers/staging/rts5208/ms.c static int ms_write_multiple_pages(struct rtsx_chip *chip, u16 old_blk, · line 3239

Quoted 2 lines
drivers/staging/rts5208/ms.c +1 -1
-		udelay(30);
+		usleep_range(27, 32);

These are very odd choices of a number, where did they come from?

And as the other thread on this mailing list a few hours ago describes, for this same type of change, you need to test this with the actual hardware to know if this works properly or not. Have you done so?

You also need to check that it is actually safe to sleep. The style of the commit messages doesn't give massive confidence that you have checked.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)