diff mbox series

[v1,02/17] pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP()

Message ID 20231122164040.2262742-3-andriy.shevchenko@linux.intel.com
State Superseded
Headers show
Series [v1,01/17] pinctrl: equilibrium: Convert to use struct pingroup | expand

Commit Message

Andy Shevchenko Nov. 22, 2023, 4:35 p.m. UTC
The pin control header provides struct pingroup and PINCTRL_PINGROUP() macro.
Utilize them instead of open coded variants in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

J. Neuschäfer Nov. 23, 2023, 11:11 a.m. UTC | #1
On Wed, Nov 22, 2023 at 06:35:34PM +0200, Andy Shevchenko wrote:
> The pin control header provides struct pingroup and PINCTRL_PINGROUP() macro.
> Utilize them instead of open coded variants in the driver.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Thanks.

>  drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> index 0cff44b07b29..4589900244c7 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> @@ -474,9 +474,8 @@ enum {
>  #undef WPCM450_GRP
>  };
>  
> -static struct group_desc wpcm450_groups[] = {
> -#define WPCM450_GRP(x) { .name = #x, .pins = x ## _pins, \
> -			.num_pins = ARRAY_SIZE(x ## _pins) }
> +static struct pingroup wpcm450_groups[] = {
> +#define WPCM450_GRP(x) PINCTRL_PINGROUP(#x, x ## _pins, ARRAY_SIZE(x ## _pins))
>  	WPCM450_GRPS
>  #undef WPCM450_GRP
>  };
> @@ -852,7 +851,7 @@ static int wpcm450_get_group_pins(struct pinctrl_dev *pctldev,
>  				  const unsigned int **pins,
>  				  unsigned int *npins)
>  {
> -	*npins = wpcm450_groups[selector].num_pins;
> +	*npins = wpcm450_groups[selector].npins;
>  	*pins  = wpcm450_groups[selector].pins;
>  
>  	return 0;
> @@ -901,7 +900,7 @@ static int wpcm450_pinmux_set_mux(struct pinctrl_dev *pctldev,
>  	struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
>  
>  	wpcm450_setfunc(pctrl->gcr_regmap, wpcm450_groups[group].pins,
> -			wpcm450_groups[group].num_pins, function);
> +			wpcm450_groups[group].npins, function);
>  
>  	return 0;
>  }
> -- 
> 2.43.0.rc1.1.gbec44491f096
>
diff mbox series

Patch

diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 0cff44b07b29..4589900244c7 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -474,9 +474,8 @@  enum {
 #undef WPCM450_GRP
 };
 
-static struct group_desc wpcm450_groups[] = {
-#define WPCM450_GRP(x) { .name = #x, .pins = x ## _pins, \
-			.num_pins = ARRAY_SIZE(x ## _pins) }
+static struct pingroup wpcm450_groups[] = {
+#define WPCM450_GRP(x) PINCTRL_PINGROUP(#x, x ## _pins, ARRAY_SIZE(x ## _pins))
 	WPCM450_GRPS
 #undef WPCM450_GRP
 };
@@ -852,7 +851,7 @@  static int wpcm450_get_group_pins(struct pinctrl_dev *pctldev,
 				  const unsigned int **pins,
 				  unsigned int *npins)
 {
-	*npins = wpcm450_groups[selector].num_pins;
+	*npins = wpcm450_groups[selector].npins;
 	*pins  = wpcm450_groups[selector].pins;
 
 	return 0;
@@ -901,7 +900,7 @@  static int wpcm450_pinmux_set_mux(struct pinctrl_dev *pctldev,
 	struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
 
 	wpcm450_setfunc(pctrl->gcr_regmap, wpcm450_groups[group].pins,
-			wpcm450_groups[group].num_pins, function);
+			wpcm450_groups[group].npins, function);
 
 	return 0;
 }