From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58C90212FAD for ; Wed, 13 May 2026 13:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778680422; cv=none; b=MwHVWY7Sg+n2vol2XfsB67mHSxjH704ZAs5vGfd/AITCYiyW3hGkQ+pt5pQfYfvsKeXOaeBxiFG13iWk1PLRR347zwKsBA3gZgrOzY85oD2GVdXx5ZABuHFbuK1owVkEEEanAFUxh8eV3ElLwpcAM5YaqyNASoKv9pMWQw5oNxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778680422; c=relaxed/simple; bh=0SNeek9+/EUO74aGv/8SUXyw+nCSXcIWMw+ODMdmn0I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q6yeQyTdAWsUvreDKIT+utccbqA7DAiRPm8GdY5Q28MGE0NU+r65TuXdPT9IbKWrRKrUyfQwprNtE9FxfPHbheVQd2VY8/PwaoF53usvIPuedIlRUPFDfRSyAcajVzstMXMq2tu7VVvYIs+qXNnZ0iYwaU+sH5kPBz7IidCzoMI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LV8R7dtx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LV8R7dtx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E95FC2BCB3; Wed, 13 May 2026 13:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778680422; bh=0SNeek9+/EUO74aGv/8SUXyw+nCSXcIWMw+ODMdmn0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LV8R7dtxsodeTv/w+ymE/UTPCiiTdY+782G9sqAuV7Ib+k6pnrKUNZ2pz4PUYPmyH siboTHzJ25SJY6FIUIDKvStnFq0UBbjfv12EUH2dTZSIhr1JQ8czzns6+Cun3jk3x8 Wk6GnTgqUoVMAm+1Mb3ngBRUQ8uJG+Pv0aVPwnLQDRHxBSy4Q/NyeStNaCQEIiY+Jj FtvptCrAx84PE7TRQ2Df8DI/1KsIZ3xjqIL4lmIis4PY/q2Avje0Kg9Wj9AuQKi0CJ EYuX7phlCl7wa7lkrW8ObSAdQH89W230scd6BuHr3UKRoLCLM4cPvXbk9FqS03/Zb3 mwgijIWDUnpew== From: Sasha Levin To: stable@vger.kernel.org Cc: Takashi Iwai , Sasha Levin Subject: [PATCH 6.12.y 1/2] ALSA: misc: Use guard() for spin locks Date: Wed, 13 May 2026 09:53:38 -0400 Message-ID: <20260513135339.3740733-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026051248-upcountry-culminate-b7a5@gregkh> References: <2026051248-upcountry-culminate-b7a5@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Takashi Iwai [ Upstream commit b8e1684163ae52db90f428965bd9aaff7205c02e ] Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: Takashi Iwai Link: https://patch.msgid.link/20250829151335.7342-20-tiwai@suse.de Stable-dep-of: 5337213381df ("ALSA: core: Serialize deferred fasync state checks") Signed-off-by: Sasha Levin --- sound/core/misc.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/sound/core/misc.c b/sound/core/misc.c index 37110dc3f4259..5aca09edf9718 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c @@ -131,35 +131,30 @@ int snd_fasync_helper(int fd, struct file *file, int on, INIT_LIST_HEAD(&fasync->list); } - spin_lock_irq(&snd_fasync_lock); - if (*fasyncp) { - kfree(fasync); - fasync = *fasyncp; - } else { - if (!fasync) { - spin_unlock_irq(&snd_fasync_lock); - return 0; + scoped_guard(spinlock_irq, &snd_fasync_lock) { + if (*fasyncp) { + kfree(fasync); + fasync = *fasyncp; + } else { + if (!fasync) + return 0; + *fasyncp = fasync; } - *fasyncp = fasync; + fasync->on = on; } - fasync->on = on; - spin_unlock_irq(&snd_fasync_lock); return fasync_helper(fd, file, on, &fasync->fasync); } EXPORT_SYMBOL_GPL(snd_fasync_helper); void snd_kill_fasync(struct snd_fasync *fasync, int signal, int poll) { - unsigned long flags; - if (!fasync || !fasync->on) return; - spin_lock_irqsave(&snd_fasync_lock, flags); + guard(spinlock_irqsave)(&snd_fasync_lock); fasync->signal = signal; fasync->poll = poll; list_move(&fasync->list, &snd_fasync_list); schedule_work(&snd_fasync_work); - spin_unlock_irqrestore(&snd_fasync_lock, flags); } EXPORT_SYMBOL_GPL(snd_kill_fasync); -- 2.53.0