Re: [PATCH] pinctrl: pinconf-generic: widen the packed config argument to unsigned long

From: Linus Walleij

Date: Tue Nov 17 2026 - 09:20:19 EST


On Mon, Nov 9, 2026 at 1:28 PM Peng Fan <peng.fan@xxxxxxxxx> wrote:

> From: Peng Fan <peng.fan@xxxxxxx>
>
> The packed pin configuration stores the parameter in the lower 8 bits and
> the argument in the remaining bits of an unsigned long. However, the
> argument was limited to 24 bits: pinconf_to_config_argument() masked it
> with 0xffffff, and pinconf_to_config_packed() took a u32 argument, so even
> on 64-bit systems the left shift in PIN_CONF_PACKED() discarded the upper
> bits. For example, the pad configuration value 0x1080000 used by a new
> i.MX SoC was packed as 0x08000000 and read back as 0x80000.
>
> Allow the argument to use the full width of unsigned long so that such
> values survive the pack/unpack round trip. Cast the argument in
> PIN_CONF_PACKED() to unsigned long to keep direct users of the macro
> consistent with pinconf_to_config_packed(), and print the full argument
> in the debugfs dumps.
>
> The packed argument only has BITS_PER_LONG - 8 bits available, so on
> 32-bit systems values above 0xffffff still cannot be represented. Reject
> such firmware properties instead of silently truncating them.
>
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>

Allright patch applied for v7.5 let's smoke it out in linux-next
and see if everything survives!

Yours,
Linus Walleij