]> git.hungrycats.org Git - linux/commitdiff
ALSA: timer: Sync timer deletion at closing the system timer
authorTakashi Iwai <tiwai@suse.de>
Tue, 2 Feb 2016 13:14:10 +0000 (14:14 +0100)
committerJiri Slaby <jslaby@suse.cz>
Thu, 21 Apr 2016 11:11:54 +0000 (13:11 +0200)
commit f146357f069e71aff8e474c625bcebcd3094b3ab upstream.

ALSA timer core framework has no sync point at stopping because it's
called inside the spinlock.  Thus we need a sync point at close for
avoiding the stray timer task.  This is simply done by implementing
the close callback just calling del_timer_sync().  (It's harmless to
call it unconditionally, as the core timer itself cares of the already
deleted timer instance.)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
sound/core/timer.c

index 38742e826900ebde5d471d164920bdba5e5b5cef..10463beae4bb248e2aa6fda1535e961707c65add 100644 (file)
@@ -1033,11 +1033,21 @@ static int snd_timer_s_stop(struct snd_timer * timer)
        return 0;
 }
 
+static int snd_timer_s_close(struct snd_timer *timer)
+{
+       struct snd_timer_system_private *priv;
+
+       priv = (struct snd_timer_system_private *)timer->private_data;
+       del_timer_sync(&priv->tlist);
+       return 0;
+}
+
 static struct snd_timer_hardware snd_timer_system =
 {
        .flags =        SNDRV_TIMER_HW_FIRST | SNDRV_TIMER_HW_TASKLET,
        .resolution =   1000000000L / HZ,
        .ticks =        10000000L,
+       .close =        snd_timer_s_close,
        .start =        snd_timer_s_start,
        .stop =         snd_timer_s_stop
 };