ASoC: codecs: cs42l84: Use guard() for mutex locks

Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260708125002.202515-17-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-07-08 19:49:53 +07:00 committed by Mark Brown
parent d1b5d20f53
commit 2f952d2ff5
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -10,6 +10,7 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/cleanup.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
@ -281,10 +282,9 @@ static int cs42l84_set_jack(struct snd_soc_component *component, struct snd_soc_
struct cs42l84_private *cs42l84 = snd_soc_component_get_drvdata(component);
/* Prevent race with interrupt handler */
mutex_lock(&cs42l84->irq_lock);
guard(mutex)(&cs42l84->irq_lock);
cs42l84->jack = jk;
snd_soc_jack_report(jk, cs42l84->hs_type, SND_JACK_HEADSET);
mutex_unlock(&cs42l84->irq_lock);
return 0;
}
@ -831,7 +831,7 @@ static irqreturn_t cs42l84_irq_thread(int irq, void *data)
u8 current_ring_state;
int i;
mutex_lock(&cs42l84->irq_lock);
guard(mutex)(&cs42l84->irq_lock);
/* Read sticky registers to clear interrupt */
for (i = 0; i < ARRAY_SIZE(stickies); i++) {
regmap_read(cs42l84->regmap, irq_params_table[i].status_addr,
@ -902,8 +902,6 @@ static irqreturn_t cs42l84_irq_thread(int irq, void *data)
break;
}
mutex_unlock(&cs42l84->irq_lock);
return IRQ_HANDLED;
}
@ -919,8 +917,6 @@ static irqreturn_t cs42l84_irq_thread(int irq, void *data)
}
}
mutex_unlock(&cs42l84->irq_lock);
return IRQ_HANDLED;
}