diff options
| author | Takashi Iwai <tiwai@suse.de> | 2025-08-29 16:43:09 +0200 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2025-09-01 13:52:41 +0200 |
| commit | 9da230b3b2296df9c3d81fe6badab59a81c3d76f (patch) | |
| tree | 8ccb341dc114cf6562f066b51ce6e0c855b70afc /sound/pci/ice1712/hoontech.c | |
| parent | 2b429331f55bf4d39a9be3357b0958d577bf9086 (diff) | |
ALSA: ice1712: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.
Only code refactoring, and no behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829144342.4290-35-tiwai@suse.de
Diffstat (limited to 'sound/pci/ice1712/hoontech.c')
| -rw-r--r-- | sound/pci/ice1712/hoontech.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index 46daeea8dc66..071f94dc7390 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c @@ -41,35 +41,35 @@ static void snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned cha static void snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate) { struct hoontech_spec *spec = ice->spec; - mutex_lock(&ice->gpio_mutex); + + guard(mutex)(&ice->gpio_mutex); ICE1712_STDSP24_0_DAREAR(spec->boxbits, activate); snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); - mutex_unlock(&ice->gpio_mutex); } static void snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate) { struct hoontech_spec *spec = ice->spec; - mutex_lock(&ice->gpio_mutex); + + guard(mutex)(&ice->gpio_mutex); ICE1712_STDSP24_3_MUTE(spec->boxbits, activate); snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); - mutex_unlock(&ice->gpio_mutex); } static void snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate) { struct hoontech_spec *spec = ice->spec; - mutex_lock(&ice->gpio_mutex); + + guard(mutex)(&ice->gpio_mutex); ICE1712_STDSP24_3_INSEL(spec->boxbits, activate); snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); - mutex_unlock(&ice->gpio_mutex); } static void snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate) { struct hoontech_spec *spec = ice->spec; - mutex_lock(&ice->gpio_mutex); + guard(mutex)(&ice->gpio_mutex); /* select box */ ICE1712_STDSP24_0_BOX(spec->boxbits, box); @@ -111,15 +111,13 @@ static void snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, in ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0); snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); - - mutex_unlock(&ice->gpio_mutex); } static void snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master) { struct hoontech_spec *spec = ice->spec; - mutex_lock(&ice->gpio_mutex); + guard(mutex)(&ice->gpio_mutex); /* select box */ ICE1712_STDSP24_0_BOX(spec->boxbits, box); @@ -139,17 +137,15 @@ static void snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int m ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); - - mutex_unlock(&ice->gpio_mutex); } static void snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) { struct hoontech_spec *spec = ice->spec; - mutex_lock(&ice->gpio_mutex); + + guard(mutex)(&ice->gpio_mutex); ICE1712_STDSP24_3_MIDI2(spec->boxbits, activate); snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); - mutex_unlock(&ice->gpio_mutex); } static int hoontech_init(struct snd_ice1712 *ice, bool staudio) |