All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.