* [PATCH] regmap: sdw-mbq: don't call an unset readable_reg callback
@ 2026-08-11 19:14 Andrey Golovko
2026-08-12 9:13 ` Charles Keepax
2026-08-12 17:08 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Andrey Golovko @ 2026-08-11 19:14 UTC (permalink / raw)
To: Mark Brown; +Cc: Charles Keepax, Pierre-Louis Bossart, linux-kernel
regmap_sdw_mbq_poll_busy() decides whether to poll the Function Busy bit
by calling ctx->readable_reg(), which is a straight copy of
config->readable_reg. That callback is optional: regmap_readable() treats
a NULL ->readable_reg as "every register is readable", and drivers rely on
that. es9356 and tac5xx2-sdw both build an MBQ regmap without one.
Since commit ca1b11b36d82 ("regmap: sdw-mbq: Allow defers on undeferrable
controls") the poll runs on every -ENODATA, not only for Controls the
driver marked deferrable, so any of those devices answering
COMMAND_IGNORED takes the kernel through a NULL function pointer.
Treat a missing callback the way the rest of regmap does and poll.
Fixes: 5bc493bf0c37 ("regmap: sdw-mbq: Add support for SDCA deferred controls")
Signed-off-by: Andrey Golovko <andrey.golovko@gmail.com>
---
Found while reading the deferral path after the discussion on Ville
Saarinen's tas2783 patch [1]; I have no device here that answers
COMMAND_IGNORED, so this is a code fix and not backed by a measurement.
It applies on top of ae7fd6ff4c67 ("regmap: sdw-mbq: Fix swap of timeout
and retry times") and does not touch the fallback behaviour that patch's
discussion settled on: a driver that does describe Function Status keeps
being asked, only a driver that describes nothing now polls instead of
faulting.
[1] https://lore.kernel.org/all/20260809101541.4969-2-wiza@saarinenkoti.fi/
drivers/base/regmap/regmap-sdw-mbq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap-sdw-mbq.c b/drivers/base/regmap/regmap-sdw-mbq.c
index 6d7c760cbef2..b0312f57c980 100644
--- a/drivers/base/regmap/regmap-sdw-mbq.c
+++ b/drivers/base/regmap/regmap-sdw-mbq.c
@@ -56,7 +56,7 @@ static int regmap_sdw_mbq_poll_busy(struct sdw_slave *slave, unsigned int reg,
reg = SDW_SDCA_CTL(SDW_SDCA_CTL_FUNC(reg), 0,
SDCA_CTL_ENTITY_0_FUNCTION_STATUS, 0);
- if (ctx->readable_reg(dev, reg)) {
+ if (!ctx->readable_reg || ctx->readable_reg(dev, reg)) {
ret = read_poll_timeout(sdw_read_no_pm, val,
val < 0 || !(val & SDCA_CTL_ENTITY_0_FUNCTION_BUSY),
ctx->cfg.retry_us, ctx->cfg.timeout_us,
base-commit: ae7fd6ff4c6713270d2efe6db87a4a58ccb7cc61
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] regmap: sdw-mbq: don't call an unset readable_reg callback
2026-08-11 19:14 [PATCH] regmap: sdw-mbq: don't call an unset readable_reg callback Andrey Golovko
@ 2026-08-12 9:13 ` Charles Keepax
2026-08-12 17:08 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2026-08-12 9:13 UTC (permalink / raw)
To: Andrey Golovko; +Cc: Mark Brown, Pierre-Louis Bossart, linux-kernel
On Tue, Aug 11, 2026 at 10:14:35PM +0300, Andrey Golovko wrote:
> regmap_sdw_mbq_poll_busy() decides whether to poll the Function Busy bit
> by calling ctx->readable_reg(), which is a straight copy of
> config->readable_reg. That callback is optional: regmap_readable() treats
> a NULL ->readable_reg as "every register is readable", and drivers rely on
> that. es9356 and tac5xx2-sdw both build an MBQ regmap without one.
>
> Since commit ca1b11b36d82 ("regmap: sdw-mbq: Allow defers on undeferrable
> controls") the poll runs on every -ENODATA, not only for Controls the
> driver marked deferrable, so any of those devices answering
> COMMAND_IGNORED takes the kernel through a NULL function pointer.
>
> Treat a missing callback the way the rest of regmap does and poll.
>
> Fixes: 5bc493bf0c37 ("regmap: sdw-mbq: Add support for SDCA deferred controls")
> Signed-off-by: Andrey Golovko <andrey.golovko@gmail.com>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] regmap: sdw-mbq: don't call an unset readable_reg callback
2026-08-11 19:14 [PATCH] regmap: sdw-mbq: don't call an unset readable_reg callback Andrey Golovko
2026-08-12 9:13 ` Charles Keepax
@ 2026-08-12 17:08 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-08-12 17:08 UTC (permalink / raw)
To: Andrey Golovko; +Cc: Charles Keepax, Pierre-Louis Bossart, linux-kernel
On Tue, 11 Aug 2026 22:14:35 +0300, Andrey Golovko wrote:
> regmap: sdw-mbq: don't call an unset readable_reg callback
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-7.2
Thanks!
[1/1] regmap: sdw-mbq: don't call an unset readable_reg callback
https://git.kernel.org/broonie/regmap/c/00268f9452d2
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-12 18:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 19:14 [PATCH] regmap: sdw-mbq: don't call an unset readable_reg callback Andrey Golovko
2026-08-12 9:13 ` Charles Keepax
2026-08-12 17:08 ` Mark Brown
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.