Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: stm32: Print invalid AF warning inside stm32_pctrl_is_function_valid()

The "invalid function %d on pin %d .\n" message is triplicated in the
driver in different variants, just pull it into the function and have
it once in the driver. The bonus is that all variants of the message
now print the pin number and AF consistently, so it is easier to debug
such pinmux problems.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabien Dessenne <fabien.dessenne@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-stm32@st-md-mailman.stormreply.com
To: linux-arm-kernel@lists.infradead.org
Acked-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Link: https://lore.kernel.org/r/20210406180035.279249-1-marex@denx.de
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Marek Vasut and committed by
Linus Walleij
589b9b8b da35b19d

+4 -9
+4 -9
drivers/pinctrl/stm32/pinctrl-stm32.c
··· 531 531 break; 532 532 } 533 533 534 + dev_err(pctl->dev, "invalid function %d on pin %d .\n", fnum, pin_num); 535 + 534 536 return false; 535 537 } 536 538 ··· 547 545 (*map)[*num_maps].type = PIN_MAP_TYPE_MUX_GROUP; 548 546 (*map)[*num_maps].data.mux.group = grp->name; 549 547 550 - if (!stm32_pctrl_is_function_valid(pctl, pin, fnum)) { 551 - dev_err(pctl->dev, "invalid function %d on pin %d .\n", 552 - fnum, pin); 548 + if (!stm32_pctrl_is_function_valid(pctl, pin, fnum)) 553 549 return -EINVAL; 554 - } 555 550 556 551 (*map)[*num_maps].data.mux.function = stm32_gpio_functions[fnum]; 557 552 (*num_maps)++; ··· 619 620 func = STM32_GET_PIN_FUNC(pinfunc); 620 621 621 622 if (!stm32_pctrl_is_function_valid(pctl, pin, func)) { 622 - dev_err(pctl->dev, "invalid function.\n"); 623 623 err = -EINVAL; 624 624 goto exit; 625 625 } ··· 819 821 int pin; 820 822 821 823 ret = stm32_pctrl_is_function_valid(pctl, g->pin, function); 822 - if (!ret) { 823 - dev_err(pctl->dev, "invalid function %d on group %d .\n", 824 - function, group); 824 + if (!ret) 825 825 return -EINVAL; 826 - } 827 826 828 827 range = pinctrl_find_gpio_range_from_pin(pctldev, g->pin); 829 828 if (!range) {