[PATCH] regmap: sdw-mbq: don't call an unset readable_reg callback
From: Andrey Golovko
Date: Tue Aug 11 2026 - 15:15:03 EST
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@xxxxxxxxx>
---
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@xxxxxxxxxxxxxxx/
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