Skip to contentSkip to conversation

staging: av7110: Replace msleep() with usleep_range() in tuner function

PATCH In review Pratibimba Khadka 2 participants 2 messages Jun 26, 2025

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

PATCH 1/1 staging: av7110: Replace msleep() with usleep_range() in tuner function

Replace msleep(10) with usleep_range(10000, 12000) in the PLL lock waiting loop of nexusca_stv0297_tuner_set_params().

usleep_range() is preferred over msleep() for short delays (< 20ms) as it provides better accuracy and allows the scheduler flexibility for power management optimizations. The 10-12ms range maintains the same timing behavior while giving the kernel scheduler room to optimize.

This change improves timing precision during the PLL lock detection phase without affecting the overall functionality of the tuner configuration process.

---
 drivers/staging/media/av7110/av7110.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/av7110/av7110.c +1 -1
index bc9a2a40afcb..7f6c610579c8 100644
@@ -1827,7 +1827,7 @@ static int nexusca_stv0297_tuner_set_params(struct dvb_frontend *fe)
 		if (i2c_transfer(&av7110->i2c_adap, &readmsg, 1) == 1)
 			if (data[0] & 0x40)
 				break;
-		msleep(10);
+		usleep_range(10000, 12000);
 	}
 
 	return 0;
Signature · 1 line
2.49.0
#1 lore raw
Quoted 8 lines · Pratibimba Khadka

Replace msleep(10) with usleep_range(10000, 12000) in the PLL lock waiting loop of nexusca_stv0297_tuner_set_params().

usleep_range() is preferred over msleep() for short delays (< 20ms) as it provides better accuracy and allows the scheduler flexibility for power management optimizations. The 10-12ms range maintains the same timing behavior while giving the kernel scheduler room to optimize.

Quoted 5 lines

This change improves timing precision during the PLL lock detection phase without affecting the overall functionality of the tuner configuration process.

Sorry, these msleep() need to be tested on real hardware for us to accept them.

regards,
dan carpenter