]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
regmap: sdw-mbq: don't call an unset readable_reg callback
authorAndrey Golovko <andrey.golovko@gmail.com>
Tue, 11 Aug 2026 19:14:35 +0000 (22:14 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 12 Aug 2026 17:08:48 +0000 (18:08 +0100)
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>
Link: https://patch.msgid.link/20260811184500.5312-1-andrey.golovko@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap-sdw-mbq.c

index 6d7c760cbef2b004365d12e4367aa523a4acd123..b0312f57c9800e15a87eeadd66d01e1fb512ce21 100644 (file)
@@ -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,