diff options
Diffstat (limited to 'sound/firewire/bebob/bebob_hwdep.c')
-rw-r--r-- | sound/firewire/bebob/bebob_hwdep.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/sound/firewire/bebob/bebob_hwdep.c b/sound/firewire/bebob/bebob_hwdep.c index 5779e99a6bb2..216d1fceb6e7 100644 --- a/sound/firewire/bebob/bebob_hwdep.c +++ b/sound/firewire/bebob/bebob_hwdep.c @@ -53,18 +53,14 @@ static __poll_t hwdep_poll(struct snd_hwdep *hwdep, struct file *file, poll_table *wait) { struct snd_bebob *bebob = hwdep->private_data; - __poll_t events; poll_wait(file, &bebob->hwdep_wait, wait); - spin_lock_irq(&bebob->lock); + guard(spinlock_irq)(&bebob->lock); if (bebob->dev_lock_changed) - events = EPOLLIN | EPOLLRDNORM; + return EPOLLIN | EPOLLRDNORM; else - events = 0; - spin_unlock_irq(&bebob->lock); - - return events; + return 0; } static int @@ -90,39 +86,27 @@ hwdep_get_info(struct snd_bebob *bebob, void __user *arg) static int hwdep_lock(struct snd_bebob *bebob) { - int err; - - spin_lock_irq(&bebob->lock); + guard(spinlock_irq)(&bebob->lock); if (bebob->dev_lock_count == 0) { bebob->dev_lock_count = -1; - err = 0; + return 0; } else { - err = -EBUSY; + return -EBUSY; } - - spin_unlock_irq(&bebob->lock); - - return err; } static int hwdep_unlock(struct snd_bebob *bebob) { - int err; - - spin_lock_irq(&bebob->lock); + guard(spinlock_irq)(&bebob->lock); if (bebob->dev_lock_count == -1) { bebob->dev_lock_count = 0; - err = 0; + return 0; } else { - err = -EBADFD; + return -EBADFD; } - - spin_unlock_irq(&bebob->lock); - - return err; } static int @@ -130,10 +114,9 @@ hwdep_release(struct snd_hwdep *hwdep, struct file *file) { struct snd_bebob *bebob = hwdep->private_data; - spin_lock_irq(&bebob->lock); + guard(spinlock_irq)(&bebob->lock); if (bebob->dev_lock_count == -1) bebob->dev_lock_count = 0; - spin_unlock_irq(&bebob->lock); return 0; } |