From: phucduc.bui@gmail.com
To: Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>,
Tzung-Bi Shih <tzungbi@kernel.org>,
David Rhodes <david.rhodes@cirrus.com>,
Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>,
Cheng-Yi Chiang <cychiang@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Benson Leung <bleung@chromium.org>,
Richard Fitzgerald <rf@opensource.cirrus.com>,
povik+lin@cutebit.org, u.kleine-koenig@baylibre.com,
kuninori.morimoto.gx@renesas.com, christian.ehrhardt@codasip.com,
Linus Walleij <linusw@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Thorsten Blum <thorsten.blum@linux.dev>,
Chris Morgan <macromorgan@hotmail.com>,
Dan Carpenter <error27@gmail.com>,
Marco Crivellari <marco.crivellari@suse.com>,
Rosen Penev <rosenp@gmail.com>,
Weidong Wang <wangweidong.a@awinic.com>,
Teguh Sobirin <teguh@sobir.in>, Val Packett <val@packett.cool>,
Luca Weiss <luca.weiss@fairphone.com>,
wangdicheng <wangdicheng@kylinos.cn>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
patches@opensource.cirrus.com, chrome-platform@lists.linux.dev,
asahi@lists.linux.dev,
Cezary Rojewski <cezary.rojewski@intel.com>,
bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH v3 13/24] ASoC: codecs: cs35l56: Use guard() and PM runtime scope helpers
Date: Tue, 7 Jul 2026 12:09:55 +0700 [thread overview]
Message-ID: <20260707051006.20058-14-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20260707051006.20058-1-phucduc.bui@gmail.com>
From: bui duc phuc <phucduc.bui@gmail.com>
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 <phucduc.bui@gmail.com>
---
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");
--
2.43.0
next prev parent reply other threads:[~2026-07-07 5:12 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 5:09 [PATCH v3 00/24] ASoC: codecs: Use guard() for mutex & spin lock - part 1 phucduc.bui
2026-07-07 5:09 ` [PATCH v3 01/24] ASoC: codecs: ab8500: Use guard() for mutex locks phucduc.bui
2026-07-07 5:09 ` [PATCH v3 02/24] ASoC: codecs: ak4613: " phucduc.bui
2026-07-07 5:09 ` [PATCH v3 03/24] ASoC: codecs: arizona-jack: Use guard() cleanup helpers phucduc.bui
2026-07-07 5:09 ` [PATCH v3 04/24] ASoC: codecs: arizona: Use guard() for mutex locks phucduc.bui
2026-07-07 5:09 ` [PATCH v3 05/24] ASoC: codecs: aw87390: " phucduc.bui
2026-07-07 5:09 ` [PATCH v3 06/24] ASoC: codecs: aw88081: " phucduc.bui
2026-07-07 5:09 ` [PATCH v3 07/24] ASoC: codecs: aw88166: " phucduc.bui
2026-07-07 5:09 ` [PATCH v3 08/24] ASoC: codecs: aw88261: " phucduc.bui
2026-07-07 5:09 ` [PATCH v3 09/24] ASoC: codecs: aw88395: " phucduc.bui
2026-07-07 5:09 ` [PATCH v3 10/24] ASoC: codecs: aw88399: " phucduc.bui
2026-07-07 5:09 ` [PATCH v3 11/24] ASoC: codecs: cros_ec_codec: " phucduc.bui
2026-07-07 5:09 ` [PATCH v3 12/24] ASoC: codecs: cs-amp-lib: " phucduc.bui
2026-07-07 5:09 ` phucduc.bui [this message]
2026-07-07 8:30 ` [PATCH v3 13/24] ASoC: codecs: cs35l56: Use guard() and PM runtime scope helpers Richard Fitzgerald
2026-07-07 5:09 ` [PATCH v3 14/24] ASoC: codecs: cs42l42: Use guard() cleanup helpers phucduc.bui
2026-07-07 5:09 ` [PATCH v3 15/24] ASoC: codecs: cs42l43: Use guard() and PM runtime scope helpers phucduc.bui
2026-07-07 8:38 ` Charles Keepax
2026-07-07 5:09 ` [PATCH v3 16/24] ASoC: codecs: cs42l84: Use guard() for mutex locks phucduc.bui
2026-07-07 5:09 ` [PATCH v3 17/24] ASoC: codecs: cs43130: " phucduc.bui
2026-07-07 8:40 ` Charles Keepax
2026-07-07 5:10 ` [PATCH v3 18/24] ASoC: codecs: cs47l15: " phucduc.bui
2026-07-07 5:10 ` [PATCH v3 19/24] ASoC: codecs: cs47l35: " phucduc.bui
2026-07-07 5:10 ` [PATCH v3 20/24] ASoC: codecs: cs47l85: " phucduc.bui
2026-07-07 5:10 ` [PATCH v3 21/24] ASoC: codecs: cs47l90: " phucduc.bui
2026-07-07 5:10 ` [PATCH v3 22/24] ASoC: codecs: cs47l92: " phucduc.bui
2026-07-07 5:10 ` [PATCH v3 23/24] ASoC: codecs: cs48l32: " phucduc.bui
2026-07-07 5:10 ` [PATCH v3 24/24] ASoC: codecs: cs2072x: " phucduc.bui
2026-07-08 8:49 ` Charles Keepax
2026-07-08 9:18 ` Bui Duc Phuc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260707051006.20058-14-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=arnd@arndb.de \
--cc=asahi@lists.linux.dev \
--cc=bleung@chromium.org \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=christian.ehrhardt@codasip.com \
--cc=chrome-platform@lists.linux.dev \
--cc=ckeepax@opensource.cirrus.com \
--cc=cychiang@chromium.org \
--cc=david.rhodes@cirrus.com \
--cc=error27@gmail.com \
--cc=groeck@chromium.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--cc=macromorgan@hotmail.com \
--cc=marco.crivellari@suse.com \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=povik+lin@cutebit.org \
--cc=rf@opensource.cirrus.com \
--cc=rosenp@gmail.com \
--cc=sakari.ailus@linux.intel.com \
--cc=teguh@sobir.in \
--cc=thorsten.blum@linux.dev \
--cc=tiwai@suse.com \
--cc=tzungbi@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=val@packett.cool \
--cc=wangdicheng@kylinos.cn \
--cc=wangweidong.a@awinic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.