diff options
author | Takashi Iwai <tiwai@suse.de> | 2024-02-27 09:52:45 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2024-02-28 15:01:20 +0100 |
commit | beb45974dd49068b24788bbfc2abe20d50503761 (patch) | |
tree | 9f677b0c7599b0883727f18148e6c537d9e23d4f /sound/core/timer_compat.c | |
parent | d648843aa4742377b22e273c80d575e98195930f (diff) |
ALSA: timer: Use guard() for locking
We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.
For making changes easier, some functions widen the application of
register_mutex, but those shouldn't influence on any actual
performance.
Also, one code block was factored out as a function so that guard()
can be applied cleanly without much indentation.
There are still a few remaining explicit spin_lock/unlock calls, and
those are for the places where we do temporary unlock/relock, which
doesn't fit well with the guard(), so far.
Only the code refactoring, and no functional changes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-4-tiwai@suse.de
Diffstat (limited to 'sound/core/timer_compat.c')
-rw-r--r-- | sound/core/timer_compat.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sound/core/timer_compat.c b/sound/core/timer_compat.c index ee973b7b8044..4ae9eaeb5afb 100644 --- a/sound/core/timer_compat.c +++ b/sound/core/timer_compat.c @@ -115,10 +115,7 @@ static long snd_timer_user_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) { struct snd_timer_user *tu = file->private_data; - long ret; - mutex_lock(&tu->ioctl_lock); - ret = __snd_timer_user_ioctl_compat(file, cmd, arg); - mutex_unlock(&tu->ioctl_lock); - return ret; + guard(mutex)(&tu->ioctl_lock); + return __snd_timer_user_ioctl_compat(file, cmd, arg); } |