Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753591AbcDVLLk (ORCPT ); Fri, 22 Apr 2016 07:11:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:44225 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753616AbcDVLGf (ORCPT ); Fri, 22 Apr 2016 07:06:35 -0400 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Takashi Iwai , Jiri Slaby Subject: [PATCH 3.12 66/78] ALSA: timer: Sync timer deletion at closing the system timer Date: Fri, 22 Apr 2016 13:05:49 +0200 Message-Id: <9a2fa0d4c5b6427c76b6d6cb8587c2080a2add93.1461323133.git.jslaby@suse.cz> X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1448 Lines: 49 From: Takashi Iwai 3.12-stable review patch. If anyone has any objections, please let me know. =============== 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 Signed-off-by: Jiri Slaby --- sound/core/timer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sound/core/timer.c b/sound/core/timer.c index 38742e826900..10463beae4bb 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -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 }; -- 2.8.1