[alsa-devel] snd_mixart_send_msg / snd_mixart_send_msg_wait_notif

Takashi Iwai tiwai at suse.de
Tue Sep 18 14:40:47 CEST 2007


At Tue, 18 Sep 2007 13:54:23 +0200,
Rene Herman wrote:
> 
> Hi.
> 
> While looking through ALSA for schedule_timeout() calls, I ran into:
> 
> int snd_mixart_send_msg(...)
> {
> 
> 	[ ... ]
> 
>          set_current_state(TASK_UNINTERRUPTIBLE);
>          add_wait_queue(&mgr->msg_sleep, &wait);
>          spin_unlock_irq(&mgr->msg_lock);
>          timeout = schedule_timeout(MSG_TIMEOUT_JIFFIES);
>          remove_wait_queue(&mgr->msg_sleep, &wait);
> 
>          if (! timeout) {
>                  /* error - no ack */
>                  mutex_unlock(&mgr->msg_mutex);
>                  snd_printk(KERN_ERR "error: no reponse on msg %x\n", 
> msg_frame);
>                  return -EIO;
>          }
> 
> 	[ ... ]
> 
> }
> 
> and the same in snd_mixart_send_msg_wait_notif().
> 
> I believe there to be  something wrong with this code. A schedule_timeout() 
> in TASK_UNINTERRUPTIBLE is always going to return 0.

No, it returns the time left at the point it's woken up.
*_uninterruptible() ignores signals but not wake_up() itself
(otherwise it makes no sense).  The description in the kernel comment
is misleading indeed.


Takashi


More information about the Alsa-devel mailing list