From: Pengpeng Hou <hppiscas@163.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: Pengpeng Hou <hppiscas@163.com>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Zhang <zhangyi@everest-semi.com>
Subject: [PATCH v2] ASoC: es9356: defer IRQ readiness until cache replay
Date: Wed, 14 Oct 2026 11:23:34 +0800 [thread overview]
Message-ID: <20261014032334.12227-1-hppiscas@163.com> (raw)
For a SoundWire peripheral that remained attached, resume clears
disable_irq before waiting for initialization and replaying the cache.
That can permit deferred interrupt work before register restoration has
succeeded.
Move this attached-device IRQ readiness update after successful cache
replay and protect it with disable_irq_lock. Preserve the entry-time
unattach_request condition because sdw_slave_wait_for_init() clears it.
The reattachment initialization path keeps its separate behavior.
Return cache replay errors with cache-only mode restored and the cache
marked dirty. Use explicit braces around the scoped guard so its internal
control flow cannot bind an else from the surrounding condition.
The issue was found by our static-analysis tool and manually reviewed.
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
Changes since the earlier 20-patch series member:
- regenerate the complete fix against current sound/for-next; the earlier
applied commit is no longer retained in the target tree
- fix the scoped-guard/dangling-else issue reported by Mark and the 0-day CI
- preserve the pre-wait attached/reattaching distinction explicitly
- restore cache-only mode after replay failure
Previous version:
https://lore.kernel.org/all/20260828113416.47061-6-pengpeng@iscas.ac.cn/
sound/soc/codecs/es9356.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/es9356.c b/sound/soc/codecs/es9356.c
index 80db0f2f4aef624ecdc145d89272e04bebc2de62..fc423ec829f468e663f65039913286086b31e66d 100644
--- a/sound/soc/codecs/es9356.c
+++ b/sound/soc/codecs/es9356.c
@@ -1105,11 +1105,9 @@ static int es9356_sdca_dev_resume(struct device *dev)
{
struct sdw_slave *slave = dev_to_sdw_dev(dev);
struct es9356_sdw_priv *es9356 = dev_get_drvdata(dev);
+ bool restore_irq = !slave->unattach_request;
int ret;
- if (!slave->unattach_request)
- es9356->disable_irq = false;
-
ret = sdw_slave_wait_for_init(slave, es9356_PROBE_TIMEOUT);
if (ret) {
sdw_show_ping_status(slave->bus, true);
@@ -1117,7 +1115,19 @@ static int es9356_sdca_dev_resume(struct device *dev)
}
regcache_cache_only(es9356->regmap, false);
- regcache_sync(es9356->regmap);
+ ret = regcache_sync(es9356->regmap);
+ if (ret) {
+ regcache_cache_only(es9356->regmap, true);
+ regcache_mark_dirty(es9356->regmap);
+ return ret;
+ }
+
+ if (restore_irq) {
+ scoped_guard(mutex, &es9356->disable_irq_lock) {
+ es9356->disable_irq = false;
+ }
+ }
+
return 0;
}
base-commit: 8ef28aef33f2d5da6959ad6b579ec3cfccc009f6
next reply other threads:[~2026-10-14 3:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 3:23 Pengpeng Hou [this message]
2026-10-15 11:36 ` Mark Brown
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=20261014032334.12227-1-hppiscas@163.com \
--to=hppiscas@163.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=zhangyi@everest-semi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®