Re: [PATCH v2 15/24] ASoC: codecs: cs42l43: Use guard() and PM runtime scope helpers
Charles Keepax <[email protected]> Mon, 6 Jul 2026 14:18:00 +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 Fri, Jul 03, 2026 at 12:53:46PM +0700, [email protected] wrote: > From: bui duc phuc <[email protected]> > > Convert mutex locking to guard(mutex) and replace explicit runtime > PM handling with runtime PM scope helpers. > This simplifies the control flow by removing explicit cleanup paths > and unnecessary 'goto' labels. > > Signed-off-by: bui duc phuc <[email protected]> > --- > @@ -374,17 +379,18 @@ irqreturn_t cs42l43_button_press(int irq, void *data) > unsigned int val = 0; > int i, ret; > > - ret = pm_runtime_resume_and_get(priv->dev); > + PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(priv->dev, pm); > + ret = PM_RUNTIME_ACQUIRE_ERR(&pm); > if (ret) { > dev_err(priv->dev, "Failed to resume for button press: %d\n", ret); > return iret; iret only really made sense with the goto, might as well drop the variable and return IRQ_NONE directly. > } > > - mutex_lock(&priv->jack_lock); > + guard(mutex)(&priv->jack_lock); > > if (!priv->button_detect_running) { > dev_dbg(priv->dev, "Spurious button press IRQ\n"); > - goto error; > + return iret; > } > irqreturn_t cs42l43_button_release(int irq, void *data) > @@ -439,13 +438,14 @@ irqreturn_t cs42l43_button_release(int irq, void *data) > irqreturn_t iret = IRQ_NONE; > int ret; > > - ret = pm_runtime_resume_and_get(priv->dev); > + PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(priv->dev, pm); > + ret = PM_RUNTIME_ACQUIRE_ERR(&pm); > if (ret) { > dev_err(priv->dev, "Failed to resume for button release: %d\n", ret); > return iret; Same in cs42l43_button_release(). Thanks, Charles