Re: [PATCH v2 2/3] regmap: mask values to val_bits on write

From: Raffaele Tranfaglia

Date: Sun Nov 29 2026 - 06:59:57 EST


On Wed, 25 Nov 2026 at 13:49, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxx> wrote:
> > no? In other words, do we have cases IRL when val_bits > 32?
>
> But this question stays for this check
>
> config->val_bits < BITS_PER_TYPE(map->format.val_mask)

No, I could not find any. Values are passed as unsigned int, the core
formatters and regmap-mmio only support up to 32 bits, and regmap-sdw-mbq
rejects anything wider. GENMASK(31, 0) is also fine, so the check is not
needed and only val_bits == 0 has to be handled:

if (config->val_bits)
map->format.val_mask = GENMASK(config->val_bits - 1, 0);
else
map->format.val_mask = UINT_MAX;

I will change it in v3.

Best regards,
Raffaele