Skip to content

Commit d532322

Browse files
committed
ALSA: usb: fcp: Use guard() for spin locks
Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent bdcdb4e commit d532322

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

sound/usb/fcp.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,6 @@ static long fcp_hwdep_read(struct snd_hwdep *hw, char __user *buf,
820820
{
821821
struct usb_mixer_interface *mixer = hw->private_data;
822822
struct fcp_data *private = mixer->private_data;
823-
unsigned long flags;
824823
long ret = 0;
825824
u32 event;
826825

@@ -832,10 +831,10 @@ static long fcp_hwdep_read(struct snd_hwdep *hw, char __user *buf,
832831
if (ret)
833832
return ret;
834833

835-
spin_lock_irqsave(&private->notify.lock, flags);
836-
event = private->notify.event;
837-
private->notify.event = 0;
838-
spin_unlock_irqrestore(&private->notify.lock, flags);
834+
scoped_guard(spinlock_irqsave, &private->notify.lock) {
835+
event = private->notify.event;
836+
private->notify.event = 0;
837+
}
839838

840839
if (copy_to_user(buf, &event, sizeof(event)))
841840
return -EFAULT;
@@ -946,11 +945,9 @@ static void fcp_notify(struct urb *urb)
946945
}
947946

948947
if (data) {
949-
unsigned long flags;
950-
951-
spin_lock_irqsave(&private->notify.lock, flags);
952-
private->notify.event |= data;
953-
spin_unlock_irqrestore(&private->notify.lock, flags);
948+
scoped_guard(spinlock_irqsave, &private->notify.lock) {
949+
private->notify.event |= data;
950+
}
954951

955952
wake_up_interruptible(&private->notify.queue);
956953
}

0 commit comments

Comments
 (0)