Skip to contentSkip to conversation

staging: wfx: Replace udelay() by usleep_range() in bh.c

PATCH In review Fabio M. De Francesco 2 participants 4 messages Apr 5, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: wfx: Replace udelay() by usleep_range() in bh.c

Replace udelay() by usleep_range() in bh.c according to checkpatch
message: "CHECK: usleep_range is preferred over udelay"

---
 drivers/staging/wfx/bh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/bh.c +1 -1
index ed53d0b45592..07ef6732973d 100644
@@ -315,7 +315,7 @@ void wfx_bh_poll_irq(struct wfx_dev *wdev)
 			dev_err(wdev->dev, "time out while polling control register\n");
 			return;
 		}
-		udelay(200);
+		usleep_range(200, 300);
 	}
 	wfx_bh_request_rx(wdev);
 }
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 13 lines · Fabio M. De Francesco

Replace udelay() by usleep_range() in bh.c according to checkpatch
message: "CHECK: usleep_range is preferred over udelay"

---
 drivers/staging/wfx/bh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/bh.c +0 -0
index ed53d0b45592..07ef6732973d 100644

drivers/staging/wfx/bh.c void wfx_bh_poll_irq(struct wfx_dev *wdev) · line 318

Quoted 5 lines
drivers/staging/wfx/bh.c +1 -1
@@ -315,7 +315,7 @@ void wfx_bh_poll_irq(struct wfx_dev *wdev)
 			dev_err(wdev->dev, "time out while polling control register\n");
 			return;
 		}
-		udelay(200);
+		usleep_range(200, 300);

Do you know that this range is safe to use? This type of change needs to be tested on a device itself.

thanks,

greg k-h

author
#2 lore raw

Thanks for your prompt reply. No, I don't know it for sure. I've just read some drivers and found that often the maximum time is about 150% of the minimum. I assumed (wrongly) that it was safe.

Can I leave usleep_range() with 200 usec for min and max time, as it was with udelay(), and let the maintainer to take care of the numbers?

Kind regards,

Fabio

Quoted 27 lines · Greg KH
Quoted 13 lines · Fabio M. De Francesco

Replace udelay() by usleep_range() in bh.c according to checkpatch
message: "CHECK: usleep_range is preferred over udelay"

---
 drivers/staging/wfx/bh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/bh.c +0 -0
index ed53d0b45592..07ef6732973d 100644

drivers/staging/wfx/bh.c void wfx_bh_poll_irq(struct wfx_dev *wdev) · line 318

Quoted 5 lines
drivers/staging/wfx/bh.c +1 -1
@@ -315,7 +315,7 @@ void wfx_bh_poll_irq(struct wfx_dev *wdev)
                      dev_err(wdev->dev, "time out while polling control register\n");
                      return;
              }
-             udelay(200);
+             usleep_range(200, 300);

Do you know that this range is safe to use? This type of change needs to be tested on a device itself.

thanks,

greg k-h

maintainer
#3 lore raw

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 6 lines · FMDF

Thanks for your prompt reply. No, I don't know it for sure. I've just read some drivers and found that often the maximum time is about 150% of the minimum. I assumed (wrongly) that it was safe.

Can I leave usleep_range() with 200 usec for min and max time, as it was with udelay(), and let the maintainer to take care of the numbers?

I would just leave it as-is for now, no need to change it.

thanks,

greg k-h