* [PATCH] staging: fbtft: Change udelay() to usleep_range()
@ 2026-01-13 17:27 Gideon Adjei
2026-01-13 17:53 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: Gideon Adjei @ 2026-01-13 17:27 UTC (permalink / raw)
To: Andy Shevchenko, Greg Kroah-Hartman
Cc: Abdun Nihaal, Dan Carpenter, Jianglei Nie, Matthew Wilcox,
dri-devel, linux-fbdev, linux-staging, linux-kernel, Gideon Adjei
Replace udelay() calls >= 100us with usleep_range() to avoid busy-waiting.
This allows the scheduler to run other tasks while waiting.
Signed-off-by: Gideon Adjei <gideonadjei.dev@gmail.com>
---
drivers/staging/fbtft/fb_tinylcd.c | 2 +-
drivers/staging/fbtft/fb_upd161704.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/fbtft/fb_tinylcd.c b/drivers/staging/fbtft/fb_tinylcd.c
index 9469248f2c50..ee8d6b10374a 100644
--- a/drivers/staging/fbtft/fb_tinylcd.c
+++ b/drivers/staging/fbtft/fb_tinylcd.c
@@ -41,7 +41,7 @@ static int init_display(struct fbtft_par *par)
0x00, 0x35, 0x33, 0x00, 0x00, 0x00);
write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, 0x55);
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
- udelay(250);
+ usleep_range(250, 400);
write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
return 0;
diff --git a/drivers/staging/fbtft/fb_upd161704.c b/drivers/staging/fbtft/fb_upd161704.c
index c680160d6380..aed5cc7cabde 100644
--- a/drivers/staging/fbtft/fb_upd161704.c
+++ b/drivers/staging/fbtft/fb_upd161704.c
@@ -32,7 +32,7 @@ static int init_display(struct fbtft_par *par)
/* oscillator start */
write_reg(par, 0x003A, 0x0001); /*Oscillator 0: stop, 1: operation */
- udelay(100);
+ usleep_range(100, 200);
/* y-setting */
write_reg(par, 0x0024, 0x007B); /* amplitude setting */
@@ -60,7 +60,7 @@ static int init_display(struct fbtft_par *par)
/* Power supply setting */
write_reg(par, 0x0019, 0x0000); /* DC/DC output setting */
- udelay(200);
+ usleep_range(200, 400);
write_reg(par, 0x001A, 0x1000); /* DC/DC frequency setting */
write_reg(par, 0x001B, 0x0023); /* DC/DC rising setting */
write_reg(par, 0x001C, 0x0C01); /* Regulator voltage setting */
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: fbtft: Change udelay() to usleep_range()
2026-01-13 17:27 [PATCH] staging: fbtft: Change udelay() to usleep_range() Gideon Adjei
@ 2026-01-13 17:53 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2026-01-13 17:53 UTC (permalink / raw)
To: Gideon Adjei
Cc: Andy Shevchenko, Greg Kroah-Hartman, Abdun Nihaal, Dan Carpenter,
Jianglei Nie, dri-devel, linux-fbdev, linux-staging, linux-kernel
On Tue, Jan 13, 2026 at 09:27:56AM -0800, Gideon Adjei wrote:
> Replace udelay() calls >= 100us with usleep_range() to avoid busy-waiting.
> This allows the scheduler to run other tasks while waiting.
Your commit message omits how you know it's safe to sleep in these
situations. Are we holding a spinlock or being called in interrupt
context, for example?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-13 17:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13 17:27 [PATCH] staging: fbtft: Change udelay() to usleep_range() Gideon Adjei
2026-01-13 17:53 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox