drivers/staging/qlge/qlge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qlge_close uses msleep for 1ms, in which case (1 - 20ms) it is preferable
to use usleep_range in non-atomic contexts, as documented in
Documentation/timers/timers-howto.rst. A range of 1 - 1.05ms is
specified here, in case the device takes slightly longer than 1ms to recover from
reset.
Signed-off-by: Arun Vijayshankar <arunvijayshankar@gmail.com>
---
drivers/staging/qlge/qlge_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 689a87d58f27..3cc4f1902c80 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -3886,7 +3886,7 @@ static int qlge_close(struct net_device *ndev)
* (Rarely happens, but possible.)
*/
while (!test_bit(QL_ADAPTER_UP, &qdev->flags))
- msleep(1);
+ usleep_range(1000, 1050);
/* Make sure refill_work doesn't re-enable napi */
for (i = 0; i < qdev->rss_ring_count; i++)
--
2.34.1
On Sun, Jun 26, 2022 at 09:53:33PM -0700, Arun Vijayshankar wrote: > qlge_close uses msleep for 1ms, in which case (1 - 20ms) it is preferable > to use usleep_range in non-atomic contexts, as documented in > Documentation/timers/timers-howto.rst. A range of 1 - 1.05ms is > specified here, in case the device takes slightly longer than 1ms to recover from > reset. > > Signed-off-by: Arun Vijayshankar <arunvijayshankar@gmail.com> > --- > drivers/staging/qlge/qlge_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c > index 689a87d58f27..3cc4f1902c80 100644 > --- a/drivers/staging/qlge/qlge_main.c > +++ b/drivers/staging/qlge/qlge_main.c > @@ -3886,7 +3886,7 @@ static int qlge_close(struct net_device *ndev) > * (Rarely happens, but possible.) > */ > while (!test_bit(QL_ADAPTER_UP, &qdev->flags)) > - msleep(1); > + usleep_range(1000, 1050); Have you tested this with a device? Doing these types of changes without access to the hardware isn't a good idea. Also, a loop that has the chance to never end should be fixed up, don't you think? thanks, greg k-h
© 2016 - 2026 Red Hat, Inc.