Commit 7bb4a8a2 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: timer: Make sure to clear pending ack list

When a card is under disconnection, we bail out immediately at each
timer interrupt or tasklet.  This might leave some items left in ack
list.  For a better integration of the upcoming change to check
ack_list emptiness, clear out the whole list upon the emergency exit
route.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8748b850
...@@ -747,6 +747,18 @@ static void snd_timer_process_callbacks(struct snd_timer *timer, ...@@ -747,6 +747,18 @@ static void snd_timer_process_callbacks(struct snd_timer *timer,
} }
} }
/* clear pending instances from ack list */
static void snd_timer_clear_callbacks(struct snd_timer *timer,
struct list_head *head)
{
unsigned long flags;
spin_lock_irqsave(&timer->lock, flags);
while (!list_empty(head))
list_del_init(head->next);
spin_unlock_irqrestore(&timer->lock, flags);
}
/* /*
* timer tasklet * timer tasklet
* *
...@@ -756,8 +768,10 @@ static void snd_timer_tasklet(unsigned long arg) ...@@ -756,8 +768,10 @@ static void snd_timer_tasklet(unsigned long arg)
struct snd_timer *timer = (struct snd_timer *) arg; struct snd_timer *timer = (struct snd_timer *) arg;
unsigned long flags; unsigned long flags;
if (timer->card && timer->card->shutdown) if (timer->card && timer->card->shutdown) {
snd_timer_clear_callbacks(timer, &timer->sack_list_head);
return; return;
}
spin_lock_irqsave(&timer->lock, flags); spin_lock_irqsave(&timer->lock, flags);
snd_timer_process_callbacks(timer, &timer->sack_list_head); snd_timer_process_callbacks(timer, &timer->sack_list_head);
...@@ -781,8 +795,10 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) ...@@ -781,8 +795,10 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
if (timer == NULL) if (timer == NULL)
return; return;
if (timer->card && timer->card->shutdown) if (timer->card && timer->card->shutdown) {
snd_timer_clear_callbacks(timer, &timer->ack_list_head);
return; return;
}
spin_lock_irqsave(&timer->lock, flags); spin_lock_irqsave(&timer->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment