[PATCH v3] staging: fbtft: Change udelay() to fsleep()

Subsystems: fbtft framebuffer drivers, staging subsystem, the rest

STALE201d

4 messages, 3 authors, 2026-01-14 · open the first message on its own page

[PATCH v3] staging: fbtft: Change udelay() to fsleep()

From: Gideon Adjei <hidden>
Date: 2026-01-13 22:17:33

Replace udelay() calls >= 100us with fsleep() to avoid busy-waiting.

The delays are used in init_display() callbacks. These callbacks are
invoked by fbtft_probe_common() during the driver's probe path. The
probe path runs in process context which already uses sleeping APIs.
This makes fsleep() safe to use in these situations.

Signed-off-by: Gideon Adjei <redacted>
---
 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..3fb15df31592 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);
+	fsleep(250);
 	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..7fe2b556e17c 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);
+	fsleep(100);
 
 	/* 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);
+	fsleep(200);
 	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

Re: [PATCH v3] staging: fbtft: Change udelay() to fsleep()

From: Andy Shevchenko <hidden>
Date: 2026-01-13 22:34:20

On Wed, Jan 14, 2026 at 12:17 AM Gideon Adjei [off-list ref] wrote:
Replace udelay() calls >= 100us with fsleep() to avoid busy-waiting.

The delays are used in init_display() callbacks. These callbacks are
invoked by fbtft_probe_common() during the driver's probe path. The
probe path runs in process context which already uses sleeping APIs.
This makes fsleep() safe to use in these situations.
You forgot to add a changelog...
Signed-off-by: Gideon Adjei <redacted>
---
...somewhere here.

No need to send v4 because of this, just reply with the changelogs for
v1->v2 and v2->v3.

Also note, it's assumed that even for such a simple patch the time
between versions is at least 24h.
 drivers/staging/fbtft/fb_tinylcd.c   | 2 +-
 drivers/staging/fbtft/fb_upd161704.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
-- 
With Best Regards,
Andy Shevchenko

Re: [PATCH v3] staging: fbtft: Change udelay() to fsleep()

From: Gideon Adjei <hidden>
Date: 2026-01-14 00:31:06

On Wed, Jan 14, 2026 at 12:33:42AM +0200, Andy Shevchenko wrote:
No need to send v4 because of this, just reply with the changelogs for
v1->v2 and v2->v3.
Changelog:

v1->v2:
- Added explanation to why usleep_range() is safe in this context to
   commit message.

v2->v3:
- Switched from usleep_range() to fsleep().
- Corrected a minor grammar error in commit message.

No functional changes to the code itself.
Also note, it's assumed that even for such a simple patch the time
between versions is at least 24h.
Thank you for the reminder regarding the expected interval between
revions. I will ensure this observed going forward.

Signed-off-by: Gideon Adjei <redacted>

Re: [PATCH v3] staging: fbtft: Change udelay() to fsleep()

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2026-01-14 06:55:23

On Tue, Jan 13, 2026 at 02:17:22PM -0800, Gideon Adjei wrote:
quoted hunk
Replace udelay() calls >= 100us with fsleep() to avoid busy-waiting.

The delays are used in init_display() callbacks. These callbacks are
invoked by fbtft_probe_common() during the driver's probe path. The
probe path runs in process context which already uses sleeping APIs.
This makes fsleep() safe to use in these situations.

Signed-off-by: Gideon Adjei <redacted>
---
 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..3fb15df31592 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);
+	fsleep(250);
Without the hardware and specifications to test this with, we can't take
this type of patch.  Please see the mailing list archives for the
multitude of times it has been rejected in the past.

sorry, but checkpatch can be ignored here.

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help