Skip to contentSkip to conversation

Replace udelay() with usleep_range() in PLL initialization code. According to Documentation/timers/timers-howto.rst, usleep_range() is preferred for delays "10us - 20ms"

PATCH In review Alexandru Costin 2 participants 2 messages Dec 29, 2025

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

PATCH 1/1 Replace udelay() with usleep_range() in PLL initialization code. According to Documentation/timers/timers-howto.rst, usleep_range() is preferred for delays "10us - 20ms"

Resolves checkpatch warnings:
WARNING: usleep_range is preferred over udelay

---
 drivers/staging/fbtft/fb_ra8875.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/fbtft/fb_ra8875.c +3 -2
index 0ab1de6647d0..130150b0f07f 100644
@@ -210,7 +210,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
 	}
 	len--;
 
-	udelay(100);
+	usleep_range(100, 120);
+
 
 	if (len) {
 		buf = (u8 *)par->buf;
@@ -231,7 +232,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
 
 	/* restore user spi-speed */
 	par->fbtftops.write = fbtft_write_spi;
-	udelay(100);
+	usleep_range(100, 120);
 }
 
 static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines · Alexandru Costin

Resolves checkpatch warnings:
WARNING: usleep_range is preferred over udelay

First of all, fix checkpatch to point to a newer API, i.e. fsleep().

...

drivers/staging/fbtft/fb_ra8875.c static void write_reg8_bus8(struct fbtft_par *par, int len, ...) · line 233

Quoted 9 lines
drivers/staging/fbtft/fb_ra8875.c +2 -2
@@ -210,7 +210,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
 
-       udelay(100);
+       usleep_range(100, 120);
 
@@ -231,7 +232,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
 
-       udelay(100);
+       usleep_range(100, 120);

This is an IO function for the hardware in question. Have you tested it? How do you know that this is a non-atomic context?

Signature · 2 lines
With Best Regards,
Andy Shevchenko