All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: wfx: Replace udelay() by usleep_range() in bh.c
@ 2021-04-05  9:52 Fabio M. De Francesco
  2021-04-05 10:03 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio M. De Francesco @ 2021-04-05  9:52 UTC (permalink / raw)
  To: outreachy-kernel, jerome.pouiller, gregkh; +Cc: Fabio M. De Francesco

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

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
 drivers/staging/wfx/bh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c
index ed53d0b45592..07ef6732973d 100644
--- a/drivers/staging/wfx/bh.c
+++ b/drivers/staging/wfx/bh.c
@@ -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);
 }
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: wfx: Replace udelay() by usleep_range() in bh.c
  2021-04-05  9:52 [PATCH] staging: wfx: Replace udelay() by usleep_range() in bh.c Fabio M. De Francesco
@ 2021-04-05 10:03 ` Greg KH
  2021-04-05 10:15   ` FMDF
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2021-04-05 10:03 UTC (permalink / raw)
  To: Fabio M. De Francesco; +Cc: outreachy-kernel, jerome.pouiller

On Mon, Apr 05, 2021 at 11:52:13AM +0200, Fabio M. De Francesco wrote:
> Replace udelay() by usleep_range() in bh.c according to checkpatch
> message: "CHECK: usleep_range is preferred over udelay"
> 
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> ---
>  drivers/staging/wfx/bh.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c
> index ed53d0b45592..07ef6732973d 100644
> --- a/drivers/staging/wfx/bh.c
> +++ b/drivers/staging/wfx/bh.c
> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: wfx: Replace udelay() by usleep_range() in bh.c
  2021-04-05 10:03 ` Greg KH
@ 2021-04-05 10:15   ` FMDF
  2021-04-05 10:17     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: FMDF @ 2021-04-05 10:15 UTC (permalink / raw)
  To: Greg KH; +Cc: outreachy-kernel, jerome.pouiller

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

On Mon, Apr 5, 2021 at 12:03 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Mon, Apr 05, 2021 at 11:52:13AM +0200, Fabio M. De Francesco wrote:
> > Replace udelay() by usleep_range() in bh.c according to checkpatch
> > message: "CHECK: usleep_range is preferred over udelay"
> >
> > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> > ---
> >  drivers/staging/wfx/bh.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c
> > index ed53d0b45592..07ef6732973d 100644
> > --- a/drivers/staging/wfx/bh.c
> > +++ b/drivers/staging/wfx/bh.c
> > @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: wfx: Replace udelay() by usleep_range() in bh.c
  2021-04-05 10:15   ` FMDF
@ 2021-04-05 10:17     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2021-04-05 10:17 UTC (permalink / raw)
  To: FMDF; +Cc: outreachy-kernel, jerome.pouiller

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

On Mon, Apr 05, 2021 at 12:15:17PM +0200, FMDF wrote:
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-05 10:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-05  9:52 [PATCH] staging: wfx: Replace udelay() by usleep_range() in bh.c Fabio M. De Francesco
2021-04-05 10:03 ` Greg KH
2021-04-05 10:15   ` FMDF
2021-04-05 10:17     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.