Re: [PATCH v3 13/24] ASoC: codecs: cs35l56: Use guard() and PM runtime scope helpers
Richard Fitzgerald <[email protected]> Tue, 7 Jul 2026 09:30:22 +0100
| Newsgroups | dev.linux.lists.chrome-platform,dev.linux.lists.asahi,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound |
|---|---|
| Message-ID | <[email protected]> |
On 7/7/26 06:09, [email protected] wrote: > From: bui duc phuc <[email protected]> > > Convert the interrupt handler to use guard(mutex) for automatic mutex > unlocking and PM_RUNTIME_ACQUIRE_IF_ENABLED() to manage the runtime PM > reference through scope-based cleanup. > This removes the explicit cleanup paths while preserving the existing > behavior. > > Signed-off-by: bui duc phuc <[email protected]> > --- > > Changes in v3: > Remove unnecessary blank lines. > Remove temporary variables and return directly. > > > sound/soc/codecs/cs35l56-shared.c | 22 +++++++--------------- > 1 file changed, 7 insertions(+), 15 deletions(-) > > diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c > index f14e2eaaa4ee..d5817e420847 100644 > --- a/sound/soc/codecs/cs35l56-shared.c > +++ b/sound/soc/codecs/cs35l56-shared.c > @@ -640,23 +640,22 @@ irqreturn_t cs35l56_irq(int irq, void *data) > unsigned int val; > int rv; > > - irqreturn_t ret = IRQ_NONE; > - > if (!cs35l56_base->init_done) > return IRQ_NONE; > > - mutex_lock(&cs35l56_base->irq_lock); > + guard(mutex)(&cs35l56_base->irq_lock); > > - rv = pm_runtime_resume_and_get(cs35l56_base->dev); > + PM_RUNTIME_ACQUIRE_IF_ENABLED(cs35l56_base->dev, pm); > + rv = PM_RUNTIME_ACQUIRE_ERR(&pm); > if (rv < 0) { > dev_err(cs35l56_base->dev, "irq: failed to get pm_runtime: %d\n", rv); > - goto err_unlock; > + return IRQ_NONE; > } > > regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_STATUS, &val); > if ((val & CS35L56_IRQ1_STS_MASK) == 0) { > dev_dbg(cs35l56_base->dev, "Spurious IRQ: no pending interrupt\n"); > - goto err; > + return IRQ_NONE; > } > > /* Ack interrupts */ > @@ -680,7 +679,7 @@ irqreturn_t cs35l56_irq(int irq, void *data) > > /* Check to see if unmasked bits are active */ > if (!status1 && !status8 && !status20) > - goto err; > + return IRQ_NONE; > > if (status1 & CS35L56_AMP_SHORT_ERR_EINT1_MASK) > dev_crit(cs35l56_base->dev, "Amp short error\n"); > @@ -688,14 +687,7 @@ irqreturn_t cs35l56_irq(int irq, void *data) > if (status8 & CS35L56_TEMP_ERR_EINT1_MASK) > dev_crit(cs35l56_base->dev, "Overtemp error\n"); > > - ret = IRQ_HANDLED; > - > -err: > - pm_runtime_put(cs35l56_base->dev); > -err_unlock: > - mutex_unlock(&cs35l56_base->irq_lock); > - > - return ret; > + return IRQ_HANDLED; > } > EXPORT_SYMBOL_NS_GPL(cs35l56_irq, "SND_SOC_CS35L56_SHARED"); > Reviewed-by: Richard Fitzgerald <[email protected]>