Skip to contentSkip to conversation

sound/vx_core: replace schedule_timeout() with

PATCH Applied Nishanth Aravamudan 2 participants 2 messages Jan 21, 2005 – Jan 24, 2005

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

PATCH 30/39 sound/vx_core: replace schedule_timeout() with

Hi,

Please consider applying.

Description: Use msleep() instead of schedule_timeout() to guarantee the task delays as expected. The check for xmsec >= 1000 / HZ seems wrong to me, as well, since if HZ==100, that means we could mdelay() for 9 msecs! msleep() should be usable in all cases when not in an interrupt handler.

sound/drivers/vx/vx_core.c +2 -3
@@ -45,9 +45,8 @@ MODULE_LICENSE("GPL");
  */
 void snd_vx_delay(vx_core_t *chip, int xmsec)
 {
-	if (! in_interrupt() && xmsec >= 1000 / HZ) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout((xmsec * HZ + 999) / 1000);
+	if (!in_interrupt()) {
+		msleep(xmsec);
 	} else {
 		mdelay(xmsec);
 	}

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

Re: [PATCH 30/39] sound/vx_core: replace schedule_timeout() with msleep()

At Fri, 21 Jan 2005 11:47:31 -0800,

Quoted 8 lines · Nishanth Aravamudan

Hi,

Please consider applying.

Description: Use msleep() instead of schedule_timeout() to guarantee the task delays as expected. The check for xmsec >= 1000 / HZ seems wrong to me, as well, since if HZ==100, that means we could mdelay() for 9 msecs!

Yes, and that's intentional. Originally there were places to call like snd_vx_delay(1) for just 1 or 2 ms in a long loop. The loop calls schedule() occasionally to take control back.
So, we didn't want to do schedule_timeout(1) for HZ=100 in such a case. This results in 10 times longer loop execution.

Quoted 2 lines

msleep() should be
usable in all cases when not in an interrupt handler.

I agree in general, but, msleep() isn't always a replacement of mdelay() if the delay time really matters.

Takashi

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors