[PATCH v3 2/4] rtc: stm32: add pinctrl and pinmux interfaces

Linus Walleij linus.walleij at linaro.org
Fri Jul 26 13:46:40 PDT 2024


On Mon, Jul 22, 2024 at 6:02 PM Valentin Caron
<valentin.caron at foss.st.com> wrote:

> STM32 RTC is capable to handle 3 specific pins of the soc.
> "out1, out2 and out2_rmp". To handle this, we use pinctrl framework.
> There is a single pin per group.
>
> Signed-off-by: Valentin Caron <valentin.caron at foss.st.com>
(...)

> +/* STM32 RTC pinctrl helpers */
> +#define STM32_RTC_PINMUX(_name, _action, ...) { \
> +       .name = (_name), \
> +       .action = (_action), \
> +       .groups = ((const char *[]){ __VA_ARGS__ }), \
> +       .num_groups = ARRAY_SIZE(((const char *[]){ __VA_ARGS__ })), \
> +}

This is a very clever and clean macro.

We have PINCTRL_PINFUNCTION() in <linux/pinctrl/pinctrl.h> which isn't
smart enough to use VA_ARGS and ARRAY_SIZE.

Now you also need .action but if it wasn't for that I would have asked
for the macro to be made generic.

The implementation is clean and impeccable.
Reviewed-by: Linus Walleij <linus.walleij at linaro.org>

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list