diff options
Diffstat (limited to 'sound/firewire/dice/dice-hwdep.c')
-rw-r--r-- | sound/firewire/dice/dice-hwdep.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/sound/firewire/dice/dice-hwdep.c b/sound/firewire/dice/dice-hwdep.c index d165dd427bd3..747ff0952483 100644 --- a/sound/firewire/dice/dice-hwdep.c +++ b/sound/firewire/dice/dice-hwdep.c @@ -55,18 +55,14 @@ static __poll_t hwdep_poll(struct snd_hwdep *hwdep, struct file *file, poll_table *wait) { struct snd_dice *dice = hwdep->private_data; - __poll_t events; poll_wait(file, &dice->hwdep_wait, wait); - spin_lock_irq(&dice->lock); + guard(spinlock_irq)(&dice->lock); if (dice->dev_lock_changed || dice->notification_bits != 0) - events = EPOLLIN | EPOLLRDNORM; + return EPOLLIN | EPOLLRDNORM; else - events = 0; - spin_unlock_irq(&dice->lock); - - return events; + return 0; } static int hwdep_get_info(struct snd_dice *dice, void __user *arg) @@ -90,48 +86,35 @@ static int hwdep_get_info(struct snd_dice *dice, void __user *arg) static int hwdep_lock(struct snd_dice *dice) { - int err; - - spin_lock_irq(&dice->lock); + guard(spinlock_irq)(&dice->lock); if (dice->dev_lock_count == 0) { dice->dev_lock_count = -1; - err = 0; + return 0; } else { - err = -EBUSY; + return -EBUSY; } - - spin_unlock_irq(&dice->lock); - - return err; } static int hwdep_unlock(struct snd_dice *dice) { - int err; - - spin_lock_irq(&dice->lock); + guard(spinlock_irq)(&dice->lock); if (dice->dev_lock_count == -1) { dice->dev_lock_count = 0; - err = 0; + return 0; } else { - err = -EBADFD; + return -EBADFD; } - - spin_unlock_irq(&dice->lock); - - return err; } static int hwdep_release(struct snd_hwdep *hwdep, struct file *file) { struct snd_dice *dice = hwdep->private_data; - spin_lock_irq(&dice->lock); + guard(spinlock_irq)(&dice->lock); if (dice->dev_lock_count == -1) dice->dev_lock_count = 0; - spin_unlock_irq(&dice->lock); return 0; } |