[PATCH] mfd: syscon: Set max_register_is_0 when syscon points to a single register

Mark Brown broonie at kernel.org
Wed Aug 28 05:57:41 PDT 2024


On Wed, Aug 28, 2024 at 07:10:08AM -0500, Nishanth Menon wrote:

> Commit 0ec74ad3c157 ("regmap: rework ->max_register handling")
> introduced explicit handling in regmap framework for register maps
> that is exactly 1 register wide. As a result, a syscon pointing
> to a single register would cause regmap checks to skip checks
> (or in the case of regmap_get_max_register, return -EINVAL) as
> max_register_is_set will not be true.

In what sense is the behaviour changed for a map that doesn't specify a
maximum register?

> Fixes: 0ec74ad3c157 ("regmap: rework ->max_register handling")

In what sense is this a fix?

> +	if (!syscon_config.max_register)
> +		syscon_config.max_register_is_0 = true;

This will cause any syscon which does not explicitly specify a maximum
register to be converted to having only one register at number 0.  That
really does not seem like a good idea - unless you've done an audit of
every single syscon to make sure they do explicitly specify a maximum
register, and confirmed that this can't be specified via DT, then it's
going to break things.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20240828/a8aaa0d9/attachment.sig>


More information about the linux-arm-kernel mailing list