diff mbox series

staging: fbtft: fb_agm1264k-fl.c: Replaced udelay by usleep_range

Message ID 20200724100907.GA8977@fbenedet-HP (mailing list archive)
State New, archived
Headers show
Series staging: fbtft: fb_agm1264k-fl.c: Replaced udelay by usleep_range | expand

Commit Message

Fabrizio Benedetti July 24, 2020, 10:09 a.m. UTC
This patch replace udelay with usleep_range
according to the Documentation/timers/timers-howto.txt .
The usleep_range have a range that is >= of udelay.

Signed-off-by: Fabrizio Benedetti <fabrizio.benedetti.82@gmail.com>
---
 drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg Kroah-Hartman July 24, 2020, 1:24 p.m. UTC | #1
On Fri, Jul 24, 2020 at 12:09:07PM +0200, Fabrizio Benedetti wrote:
> This patch replace udelay with usleep_range
> according to the Documentation/timers/timers-howto.txt .
> The usleep_range have a range that is >= of udelay.
> 
> Signed-off-by: Fabrizio Benedetti <fabrizio.benedetti.82@gmail.com>
> ---
>  drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c
> index eeeeec97ad27..4a67a660bb17 100644
> --- a/drivers/staging/fbtft/fb_agm1264k-fl.c
> +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
> @@ -85,7 +85,7 @@ static void reset(struct fbtft_par *par)
>  	dev_dbg(par->info->device, "%s()\n", __func__);
>  
>  	gpiod_set_value(par->gpio.reset, 0);
> -	udelay(20);
> +	usleep_range(20, 25);

And are you sure that 25 is ok here?

Unless you have the hardware, don't make up random numbers for things
like delays :)

Also, be sure you use the correct mailing lists, why did you ignore the
output of scripts/get_maintainer.pl for this patch?

thanks,

greg k-h
Andy Shevchenko July 26, 2020, 8:06 a.m. UTC | #2
On Fri, Jul 24, 2020 at 1:10 PM Fabrizio Benedetti
<fabrizio.benedetti.82@gmail.com> wrote:
>
> This patch replace udelay with usleep_range
> according to the Documentation/timers/timers-howto.txt .
> The usleep_range have a range that is >= of udelay.

has

Also all functions we refer to as func(). Note parentheses.

...

> @@ -85,7 +85,7 @@ static void reset(struct fbtft_par *par)
>         dev_dbg(par->info->device, "%s()\n", __func__);
>
>         gpiod_set_value(par->gpio.reset, 0);
> -       udelay(20);
> +       usleep_range(20, 25);
>         gpiod_set_value(par->gpio.reset, 1);
>         mdelay(120);
>  }

It's funny you left mdelay and on top of this all of the above makes
sense if you also switch to gpiod_set_value_can_sleep().

This will also require your analysis of the context (atomic /
non-atomic) in the commit message.
diff mbox series

Patch

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c
index eeeeec97ad27..4a67a660bb17 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -85,7 +85,7 @@  static void reset(struct fbtft_par *par)
 	dev_dbg(par->info->device, "%s()\n", __func__);
 
 	gpiod_set_value(par->gpio.reset, 0);
-	udelay(20);
+	usleep_range(20, 25);
 	gpiod_set_value(par->gpio.reset, 1);
 	mdelay(120);
 }