Skip to content

Commit 0af4c12

Browse files
claudiubeznealinusw
authored andcommitted
pinctrl: pinconf-generic: Print unsigned value if a format is registered
Commit 3ba11e6 ("pinctrl: pinconf-generic: print hex value") unconditionally switched to printing hex values in pinconf_generic_dump_one(). However, if a dump format is registered for the dumped pin, the hex value is printed as well. This hex value does not necessarily correspond 1:1 with the hardware register value (as noted by commit 3ba11e6 ("pinctrl: pinconf-generic: print hex value")). As a result, user-facing output may include information like: output drive strength (0x100 uA). To address this, check if a dump format is registered for the dumped property, and print the unsigned value instead when applicable. Fixes: 3ba11e6 ("pinctrl: pinconf-generic: print hex value") Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Link: https://lore.kernel.org/20250205101058.2034860-1-claudiu.beznea.uj@bp.renesas.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 1ddee69 commit 0af4c12

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/pinctrl/pinconf-generic.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ static void pinconf_generic_dump_one(struct pinctrl_dev *pctldev,
8989
seq_puts(s, items[i].display);
9090
/* Print unit if available */
9191
if (items[i].has_arg) {
92-
seq_printf(s, " (0x%x",
93-
pinconf_to_config_argument(config));
92+
u32 val = pinconf_to_config_argument(config);
93+
9494
if (items[i].format)
95-
seq_printf(s, " %s)", items[i].format);
95+
seq_printf(s, " (%u %s)", val, items[i].format);
9696
else
97-
seq_puts(s, ")");
97+
seq_printf(s, " (0x%x)", val);
9898
}
9999
}
100100
}

0 commit comments

Comments
 (0)