Skip to contentSkip to conversation

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

PATCH In review Fabrizio Benedetti 3 participants 3 messages Jul 24, 2020 – Jul 26, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fb_agm1264k-fl.c +1 -1
index eeeeec97ad27..4a67a660bb17 100644
@@ -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);
 }
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 14 lines · Fabrizio Benedetti

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.

---
 drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fb_agm1264k-fl.c +0 -0
index eeeeec97ad27..4a67a660bb17 100644

drivers/staging/fbtft/fb_agm1264k-fl.c static void reset(struct fbtft_par *par) · line 88

Quoted 5 lines
drivers/staging/fbtft/fb_agm1264k-fl.c +1 -1
@@ -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

#2 lore raw
In reply to Fabrizio Benedetti
Quoted 4 lines · Fabrizio Benedetti

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.

...

drivers/staging/fbtft/fb_agm1264k-fl.c static void reset(struct fbtft_par *par) · line 91

Quoted 9 lines
drivers/staging/fbtft/fb_agm1264k-fl.c +1 -1
@@ -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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko