diff options
| author | Takashi Iwai <tiwai@suse.de> | 2025-08-29 18:13:19 +0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2025-09-01 14:54:27 +0300 |
| commit | 826f35b829f43dc62fb847eca6f79e8698b4994d (patch) | |
| tree | 2951f7d034a2286d2684e15a893783405dfc1d7f /include/sound | |
| parent | 59ede7178d402b3bfa0266cbd9ad348d5612c295 (diff) | |
| download | linux-826f35b829f43dc62fb847eca6f79e8698b4994d.tar.xz | |
ALSA: synth: Use guard() for preset locks
Define a macro for the preset locking/unlocking pairs for soundfont
using guard() macro as a further code cleanup.
The new macro is put in soundfont.h (and some function renames) along
with it for avoiding unnecessary troubles with clang.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-6-tiwai@suse.de
Diffstat (limited to 'include/sound')
| -rw-r--r-- | include/sound/soundfont.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h index 8a40cc15f66d..48f8cf6de3ac 100644 --- a/include/sound/soundfont.h +++ b/include/sound/soundfont.h @@ -114,5 +114,23 @@ int snd_sf_calc_parm_decay(int msec); extern int snd_sf_vol_table[128]; int snd_sf_linear_to_log(unsigned int amount, int offset, int ratio); +/* lock access to sflist */ +static inline void snd_soundfont_lock_preset(struct snd_sf_list *sflist) +{ + mutex_lock(&sflist->presets_mutex); + guard(spinlock_irqsave)(&sflist->lock); + sflist->presets_locked = 1; +} + +/* remove lock */ +static inline void snd_soundfont_unlock_preset(struct snd_sf_list *sflist) +{ + guard(spinlock_irqsave)(&sflist->lock); + sflist->presets_locked = 0; + mutex_unlock(&sflist->presets_mutex); +} + +DEFINE_GUARD(snd_soundfont_lock_preset, struct snd_sf_list *, + snd_soundfont_lock_preset(_T), snd_soundfont_unlock_preset(_T)) #endif /* __SOUND_SOUNDFONT_H */ |
