Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Subject: [PATCH 10/14] ALSA: usb: fcp: Use guard() for spin locks
Date: Wed, 10 Sep 2025 13:09:25 +0200	[thread overview]
Message-ID: <20250910110932.15234-11-tiwai@suse.de> (raw)
In-Reply-To: <20250910110932.15234-1-tiwai@suse.de>

Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/fcp.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c
index 98f9964311a7..5ee8d8b66058 100644
--- a/sound/usb/fcp.c
+++ b/sound/usb/fcp.c
@@ -820,7 +820,6 @@ static long fcp_hwdep_read(struct snd_hwdep *hw, char __user *buf,
 {
 	struct usb_mixer_interface *mixer = hw->private_data;
 	struct fcp_data *private = mixer->private_data;
-	unsigned long flags;
 	long ret = 0;
 	u32 event;
 
@@ -832,10 +831,10 @@ static long fcp_hwdep_read(struct snd_hwdep *hw, char __user *buf,
 	if (ret)
 		return ret;
 
-	spin_lock_irqsave(&private->notify.lock, flags);
-	event = private->notify.event;
-	private->notify.event = 0;
-	spin_unlock_irqrestore(&private->notify.lock, flags);
+	scoped_guard(spinlock_irqsave, &private->notify.lock) {
+		event = private->notify.event;
+		private->notify.event = 0;
+	}
 
 	if (copy_to_user(buf, &event, sizeof(event)))
 		return -EFAULT;
@@ -946,11 +945,9 @@ static void fcp_notify(struct urb *urb)
 	}
 
 	if (data) {
-		unsigned long flags;
-
-		spin_lock_irqsave(&private->notify.lock, flags);
-		private->notify.event |= data;
-		spin_unlock_irqrestore(&private->notify.lock, flags);
+		scoped_guard(spinlock_irqsave, &private->notify.lock) {
+			private->notify.event |= data;
+		}
 
 		wake_up_interruptible(&private->notify.queue);
 	}
-- 
2.50.1


  parent reply	other threads:[~2025-09-10 11:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-10 11:09 [PATCH RESEND 00/14] ALSA: Use guard() for spin locks (for the rest legacy stuff) Takashi Iwai
2025-09-10 11:09 ` [PATCH 01/14] ALSA: aoa: Use guard() for spin locks Takashi Iwai
2025-09-10 11:09 ` [PATCH 02/14] ALSA: aoa: Don't split string across lines Takashi Iwai
2025-09-10 11:09 ` [PATCH 03/14] ALSA: arm: Use guard() for spin locks Takashi Iwai
2025-09-10 11:09 ` [PATCH 04/14] ALSA: sgio2audio: " Takashi Iwai
2025-09-10 11:09 ` [PATCH 05/14] ALSA: snd-n64: " Takashi Iwai
2025-09-10 11:09 ` [PATCH 06/14] ALSA: parisc: " Takashi Iwai
2025-09-10 11:09 ` [PATCH 07/14] ALSA: snd_ps3: " Takashi Iwai
2025-09-10 11:09 ` [PATCH 08/14] ALSA: ppc: " Takashi Iwai
2025-09-10 11:09 ` [PATCH 09/14] ALSA: line6: " Takashi Iwai
2025-09-10 11:09 ` Takashi Iwai [this message]
2025-09-10 11:09 ` [PATCH 11/14] ALSA: usb-audio: " Takashi Iwai
2025-09-10 11:09 ` [PATCH 12/14] ALSA: sparc/amd7930: " Takashi Iwai
2025-09-10 11:09 ` [PATCH 13/14] ALSA: sparc/cs4231: " Takashi Iwai
2025-09-10 11:09 ` [PATCH 14/14] ALSA: sparc/dbri: " Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250910110932.15234-11-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-sound@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox