diff mbox series

[v1,3/4] pinctrl: nuvoton: Convert to use struct group_desc

Message ID 20240611093127.90210-4-andy.shevchenko@gmail.com
State New
Headers show
Series pinctrl: nuvoton: A few cleanups | expand

Commit Message

Andy Shevchenko June 11, 2024, 9:30 a.m. UTC
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

The pin control core header provides struct group_desc.
Utilize it instead of open coded variants in the driver.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/pinctrl/nuvoton/pinctrl-ma35.c | 66 ++++++++++++--------------
 1 file changed, 31 insertions(+), 35 deletions(-)

Comments

kernel test robot June 11, 2024, 10:01 p.m. UTC | #1
Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on linusw-pinctrl/for-next next-20240611]
[cannot apply to linus/master v6.10-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/pinctrl-nuvoton-Convert-to-use-struct-pingroup-and-PINCTRL_PINGROUP/20240611-173545
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link:    https://lore.kernel.org/r/20240611093127.90210-4-andy.shevchenko%40gmail.com
patch subject: [PATCH v1 3/4] pinctrl: nuvoton: Convert to use struct group_desc
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240612/202406120534.9nmyKZwv-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 4403cdbaf01379de96f8d0d6ea4f51a085e37766)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240612/202406120534.9nmyKZwv-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406120534.9nmyKZwv-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/pinctrl/nuvoton/pinctrl-ma35.c:13:
   In file included from include/linux/gpio/driver.h:8:
   In file included from include/linux/irqchip/chained_irq.h:10:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from drivers/pinctrl/nuvoton/pinctrl-ma35.c:13:
   In file included from include/linux/gpio/driver.h:8:
   In file included from include/linux/irqchip/chained_irq.h:10:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from drivers/pinctrl/nuvoton/pinctrl-ma35.c:13:
   In file included from include/linux/gpio/driver.h:8:
   In file included from include/linux/irqchip/chained_irq.h:10:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> drivers/pinctrl/nuvoton/pinctrl-ma35.c:228:23: error: no member named 'npins' in 'struct group_desc'
     228 |         for (i = 0; i < grp->npins; i++) {
         |                         ~~~  ^
   drivers/pinctrl/nuvoton/pinctrl-ma35.c:287:23: error: no member named 'npins' in 'struct group_desc'
     287 |         for (i = 0; i < grp->npins; i++) {
         |                         ~~~  ^
   6 warnings and 2 errors generated.


vim +228 drivers/pinctrl/nuvoton/pinctrl-ma35.c

ecc5bf86867344 Jacky Huang     2024-05-21  184  
ecc5bf86867344 Jacky Huang     2024-05-21  185  static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev,
ecc5bf86867344 Jacky Huang     2024-05-21  186  					    struct device_node *np,
ecc5bf86867344 Jacky Huang     2024-05-21  187  					    struct pinctrl_map **map,
ecc5bf86867344 Jacky Huang     2024-05-21  188  					    unsigned int *num_maps)
ecc5bf86867344 Jacky Huang     2024-05-21  189  {
ecc5bf86867344 Jacky Huang     2024-05-21  190  	struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev);
888aa25ee6ce72 Andy Shevchenko 2024-06-11  191  	struct ma35_pin_setting *setting;
ecc5bf86867344 Jacky Huang     2024-05-21  192  	struct pinctrl_map *new_map;
ecc5bf86867344 Jacky Huang     2024-05-21  193  	struct device_node *parent;
888aa25ee6ce72 Andy Shevchenko 2024-06-11  194  	struct group_desc *grp;
ecc5bf86867344 Jacky Huang     2024-05-21  195  	int map_num = 1;
ecc5bf86867344 Jacky Huang     2024-05-21  196  	int i;
ecc5bf86867344 Jacky Huang     2024-05-21  197  
ecc5bf86867344 Jacky Huang     2024-05-21  198  	/*
ecc5bf86867344 Jacky Huang     2024-05-21  199  	 * first find the group of this node and check if we need create
ecc5bf86867344 Jacky Huang     2024-05-21  200  	 * config maps for pins
ecc5bf86867344 Jacky Huang     2024-05-21  201  	 */
ecc5bf86867344 Jacky Huang     2024-05-21  202  	grp = ma35_pinctrl_find_group_by_name(npctl, np->name);
ecc5bf86867344 Jacky Huang     2024-05-21  203  	if (!grp) {
ecc5bf86867344 Jacky Huang     2024-05-21  204  		dev_err(npctl->dev, "unable to find group for node %s\n", np->name);
ecc5bf86867344 Jacky Huang     2024-05-21  205  		return -EINVAL;
ecc5bf86867344 Jacky Huang     2024-05-21  206  	}
ecc5bf86867344 Jacky Huang     2024-05-21  207  
888aa25ee6ce72 Andy Shevchenko 2024-06-11  208  	map_num += grp->grp.npins;
ecc5bf86867344 Jacky Huang     2024-05-21  209  	new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), GFP_KERNEL);
ecc5bf86867344 Jacky Huang     2024-05-21  210  	if (!new_map)
ecc5bf86867344 Jacky Huang     2024-05-21  211  		return -ENOMEM;
ecc5bf86867344 Jacky Huang     2024-05-21  212  
ecc5bf86867344 Jacky Huang     2024-05-21  213  	*map = new_map;
ecc5bf86867344 Jacky Huang     2024-05-21  214  	*num_maps = map_num;
ecc5bf86867344 Jacky Huang     2024-05-21  215  	/* create mux map */
ecc5bf86867344 Jacky Huang     2024-05-21  216  	parent = of_get_parent(np);
ecc5bf86867344 Jacky Huang     2024-05-21  217  	if (!parent)
ecc5bf86867344 Jacky Huang     2024-05-21  218  		return -EINVAL;
ecc5bf86867344 Jacky Huang     2024-05-21  219  
888aa25ee6ce72 Andy Shevchenko 2024-06-11  220  	setting = grp->data;
888aa25ee6ce72 Andy Shevchenko 2024-06-11  221  
ecc5bf86867344 Jacky Huang     2024-05-21  222  	new_map[0].type = PIN_MAP_TYPE_MUX_GROUP;
ecc5bf86867344 Jacky Huang     2024-05-21  223  	new_map[0].data.mux.function = parent->name;
ecc5bf86867344 Jacky Huang     2024-05-21  224  	new_map[0].data.mux.group = np->name;
ecc5bf86867344 Jacky Huang     2024-05-21  225  	of_node_put(parent);
ecc5bf86867344 Jacky Huang     2024-05-21  226  
ecc5bf86867344 Jacky Huang     2024-05-21  227  	new_map++;
ecc5bf86867344 Jacky Huang     2024-05-21 @228  	for (i = 0; i < grp->npins; i++) {
ecc5bf86867344 Jacky Huang     2024-05-21  229  		new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
888aa25ee6ce72 Andy Shevchenko 2024-06-11  230  		new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, grp->grp.pins[i]);
888aa25ee6ce72 Andy Shevchenko 2024-06-11  231  		new_map[i].data.configs.configs = setting[i].configs;
888aa25ee6ce72 Andy Shevchenko 2024-06-11  232  		new_map[i].data.configs.num_configs = setting[i].nconfigs;
ecc5bf86867344 Jacky Huang     2024-05-21  233  	}
ecc5bf86867344 Jacky Huang     2024-05-21  234  	dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n",
ecc5bf86867344 Jacky Huang     2024-05-21  235  		(*map)->data.mux.function, (*map)->data.mux.group, map_num);
ecc5bf86867344 Jacky Huang     2024-05-21  236  
ecc5bf86867344 Jacky Huang     2024-05-21  237  	return 0;
ecc5bf86867344 Jacky Huang     2024-05-21  238  }
ecc5bf86867344 Jacky Huang     2024-05-21  239
kernel test robot June 11, 2024, 11:50 p.m. UTC | #2
Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on linusw-pinctrl/for-next next-20240611]
[cannot apply to linus/master v6.10-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/pinctrl-nuvoton-Convert-to-use-struct-pingroup-and-PINCTRL_PINGROUP/20240611-173545
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link:    https://lore.kernel.org/r/20240611093127.90210-4-andy.shevchenko%40gmail.com
patch subject: [PATCH v1 3/4] pinctrl: nuvoton: Convert to use struct group_desc
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240612/202406120754.BLemVAqf-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240612/202406120754.BLemVAqf-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406120754.BLemVAqf-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/pinctrl/nuvoton/pinctrl-ma35.c: In function 'ma35_pinctrl_dt_node_to_map_func':
>> drivers/pinctrl/nuvoton/pinctrl-ma35.c:228:28: error: 'struct group_desc' has no member named 'npins'
     228 |         for (i = 0; i < grp->npins; i++) {
         |                            ^~
   drivers/pinctrl/nuvoton/pinctrl-ma35.c: In function 'ma35_pinmux_set_mux':
   drivers/pinctrl/nuvoton/pinctrl-ma35.c:287:28: error: 'struct group_desc' has no member named 'npins'
     287 |         for (i = 0; i < grp->npins; i++) {
         |                            ^~


vim +228 drivers/pinctrl/nuvoton/pinctrl-ma35.c

ecc5bf868673446 Jacky Huang     2024-05-21  184  
ecc5bf868673446 Jacky Huang     2024-05-21  185  static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev,
ecc5bf868673446 Jacky Huang     2024-05-21  186  					    struct device_node *np,
ecc5bf868673446 Jacky Huang     2024-05-21  187  					    struct pinctrl_map **map,
ecc5bf868673446 Jacky Huang     2024-05-21  188  					    unsigned int *num_maps)
ecc5bf868673446 Jacky Huang     2024-05-21  189  {
ecc5bf868673446 Jacky Huang     2024-05-21  190  	struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev);
888aa25ee6ce72d Andy Shevchenko 2024-06-11  191  	struct ma35_pin_setting *setting;
ecc5bf868673446 Jacky Huang     2024-05-21  192  	struct pinctrl_map *new_map;
ecc5bf868673446 Jacky Huang     2024-05-21  193  	struct device_node *parent;
888aa25ee6ce72d Andy Shevchenko 2024-06-11  194  	struct group_desc *grp;
ecc5bf868673446 Jacky Huang     2024-05-21  195  	int map_num = 1;
ecc5bf868673446 Jacky Huang     2024-05-21  196  	int i;
ecc5bf868673446 Jacky Huang     2024-05-21  197  
ecc5bf868673446 Jacky Huang     2024-05-21  198  	/*
ecc5bf868673446 Jacky Huang     2024-05-21  199  	 * first find the group of this node and check if we need create
ecc5bf868673446 Jacky Huang     2024-05-21  200  	 * config maps for pins
ecc5bf868673446 Jacky Huang     2024-05-21  201  	 */
ecc5bf868673446 Jacky Huang     2024-05-21  202  	grp = ma35_pinctrl_find_group_by_name(npctl, np->name);
ecc5bf868673446 Jacky Huang     2024-05-21  203  	if (!grp) {
ecc5bf868673446 Jacky Huang     2024-05-21  204  		dev_err(npctl->dev, "unable to find group for node %s\n", np->name);
ecc5bf868673446 Jacky Huang     2024-05-21  205  		return -EINVAL;
ecc5bf868673446 Jacky Huang     2024-05-21  206  	}
ecc5bf868673446 Jacky Huang     2024-05-21  207  
888aa25ee6ce72d Andy Shevchenko 2024-06-11  208  	map_num += grp->grp.npins;
ecc5bf868673446 Jacky Huang     2024-05-21  209  	new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), GFP_KERNEL);
ecc5bf868673446 Jacky Huang     2024-05-21  210  	if (!new_map)
ecc5bf868673446 Jacky Huang     2024-05-21  211  		return -ENOMEM;
ecc5bf868673446 Jacky Huang     2024-05-21  212  
ecc5bf868673446 Jacky Huang     2024-05-21  213  	*map = new_map;
ecc5bf868673446 Jacky Huang     2024-05-21  214  	*num_maps = map_num;
ecc5bf868673446 Jacky Huang     2024-05-21  215  	/* create mux map */
ecc5bf868673446 Jacky Huang     2024-05-21  216  	parent = of_get_parent(np);
ecc5bf868673446 Jacky Huang     2024-05-21  217  	if (!parent)
ecc5bf868673446 Jacky Huang     2024-05-21  218  		return -EINVAL;
ecc5bf868673446 Jacky Huang     2024-05-21  219  
888aa25ee6ce72d Andy Shevchenko 2024-06-11  220  	setting = grp->data;
888aa25ee6ce72d Andy Shevchenko 2024-06-11  221  
ecc5bf868673446 Jacky Huang     2024-05-21  222  	new_map[0].type = PIN_MAP_TYPE_MUX_GROUP;
ecc5bf868673446 Jacky Huang     2024-05-21  223  	new_map[0].data.mux.function = parent->name;
ecc5bf868673446 Jacky Huang     2024-05-21  224  	new_map[0].data.mux.group = np->name;
ecc5bf868673446 Jacky Huang     2024-05-21  225  	of_node_put(parent);
ecc5bf868673446 Jacky Huang     2024-05-21  226  
ecc5bf868673446 Jacky Huang     2024-05-21  227  	new_map++;
ecc5bf868673446 Jacky Huang     2024-05-21 @228  	for (i = 0; i < grp->npins; i++) {
ecc5bf868673446 Jacky Huang     2024-05-21  229  		new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
888aa25ee6ce72d Andy Shevchenko 2024-06-11  230  		new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, grp->grp.pins[i]);
888aa25ee6ce72d Andy Shevchenko 2024-06-11  231  		new_map[i].data.configs.configs = setting[i].configs;
888aa25ee6ce72d Andy Shevchenko 2024-06-11  232  		new_map[i].data.configs.num_configs = setting[i].nconfigs;
ecc5bf868673446 Jacky Huang     2024-05-21  233  	}
ecc5bf868673446 Jacky Huang     2024-05-21  234  	dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n",
ecc5bf868673446 Jacky Huang     2024-05-21  235  		(*map)->data.mux.function, (*map)->data.mux.group, map_num);
ecc5bf868673446 Jacky Huang     2024-05-21  236  
ecc5bf868673446 Jacky Huang     2024-05-21  237  	return 0;
ecc5bf868673446 Jacky Huang     2024-05-21  238  }
ecc5bf868673446 Jacky Huang     2024-05-21  239
diff mbox series

Patch

diff --git a/drivers/pinctrl/nuvoton/pinctrl-ma35.c b/drivers/pinctrl/nuvoton/pinctrl-ma35.c
index 62e877b76a25..7c2b0039d1e4 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-ma35.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-ma35.c
@@ -106,13 +106,6 @@  struct ma35_pin_setting {
 	unsigned int		nconfigs;
 };
 
-struct ma35_pin_group {
-	const char		*name;
-	unsigned int		npins;
-	unsigned int		*pins;
-	struct ma35_pin_setting	*settings;
-};
-
 struct ma35_pin_bank {
 	void __iomem		*reg_base;
 	struct clk		*clk;
@@ -141,7 +134,7 @@  struct ma35_pinctrl {
 	struct pinctrl_dev	*pctl;
 	const struct ma35_pinctrl_soc_info *info;
 	struct regmap		*regmap;
-	struct ma35_pin_group	*groups;
+	struct group_desc	*groups;
 	unsigned int		ngroups;
 	struct pinfunction	*functions;
 	unsigned int		nfunctions;
@@ -160,7 +153,7 @@  static const char *ma35_get_group_name(struct pinctrl_dev *pctldev, unsigned int
 {
 	struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev);
 
-	return npctl->groups[selector].name;
+	return npctl->groups[selector].grp.name;
 }
 
 static int ma35_get_group_pins(struct pinctrl_dev *pctldev, unsigned int selector,
@@ -171,19 +164,19 @@  static int ma35_get_group_pins(struct pinctrl_dev *pctldev, unsigned int selecto
 	if (selector >= npctl->ngroups)
 		return -EINVAL;
 
-	*pins = npctl->groups[selector].pins;
-	*npins = npctl->groups[selector].npins;
+	*pins = npctl->groups[selector].grp.pins;
+	*npins = npctl->groups[selector].grp.npins;
 
 	return 0;
 }
 
-static struct ma35_pin_group *ma35_pinctrl_find_group_by_name(
-			      const struct ma35_pinctrl *npctl, const char *name)
+static struct group_desc *
+ma35_pinctrl_find_group_by_name(const struct ma35_pinctrl *npctl, const char *name)
 {
 	int i;
 
 	for (i = 0; i < npctl->ngroups; i++) {
-		if (!strcmp(npctl->groups[i].name, name))
+		if (!strcmp(npctl->groups[i].grp.name, name))
 			return &npctl->groups[i];
 	}
 	return NULL;
@@ -195,9 +188,10 @@  static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev,
 					    unsigned int *num_maps)
 {
 	struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev);
-	struct ma35_pin_group *grp;
+	struct ma35_pin_setting *setting;
 	struct pinctrl_map *new_map;
 	struct device_node *parent;
+	struct group_desc *grp;
 	int map_num = 1;
 	int i;
 
@@ -211,7 +205,7 @@  static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev,
 		return -EINVAL;
 	}
 
-	map_num += grp->npins;
+	map_num += grp->grp.npins;
 	new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), GFP_KERNEL);
 	if (!new_map)
 		return -ENOMEM;
@@ -223,6 +217,8 @@  static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev,
 	if (!parent)
 		return -EINVAL;
 
+	setting = grp->data;
+
 	new_map[0].type = PIN_MAP_TYPE_MUX_GROUP;
 	new_map[0].data.mux.function = parent->name;
 	new_map[0].data.mux.group = np->name;
@@ -231,9 +227,9 @@  static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev,
 	new_map++;
 	for (i = 0; i < grp->npins; i++) {
 		new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
-		new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, grp->pins[i]);
-		new_map[i].data.configs.configs = grp->settings[i].configs;
-		new_map[i].data.configs.num_configs = grp->settings[i].nconfigs;
+		new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, grp->grp.pins[i]);
+		new_map[i].data.configs.configs = setting[i].configs;
+		new_map[i].data.configs.num_configs = setting[i].nconfigs;
 	}
 	dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n",
 		(*map)->data.mux.function, (*map)->data.mux.group, map_num);
@@ -281,12 +277,12 @@  static int ma35_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int selecto
 			       unsigned int group)
 {
 	struct ma35_pinctrl *npctl = pinctrl_dev_get_drvdata(pctldev);
-	struct ma35_pin_group *grp = &npctl->groups[group];
-	struct ma35_pin_setting *setting = grp->settings;
+	struct group_desc *grp = &npctl->groups[group];
+	struct ma35_pin_setting *setting = grp->data;
 	u32 i, regval;
 
 	dev_dbg(npctl->dev, "enable function %s group %s\n",
-		npctl->functions[selector].name, npctl->groups[group].name);
+		npctl->functions[selector].name, grp->grp.name);
 
 	for (i = 0; i < grp->npins; i++) {
 		regmap_read(npctl->regmap, setting->offset, &regval);
@@ -980,17 +976,16 @@  static const struct pinconf_ops ma35_pinconf_ops = {
 	.is_generic = true,
 };
 
-static int ma35_pinctrl_parse_groups(struct device_node *np, struct ma35_pin_group *grp,
+static int ma35_pinctrl_parse_groups(struct device_node *np, struct group_desc *grp,
 				     struct ma35_pinctrl *npctl, u32 index)
 {
 	struct ma35_pin_setting *pin;
 	unsigned long *configs;
 	unsigned int nconfigs;
+	unsigned int *pins;
 	int i, j, count, ret;
 	u32 *elems;
 
-	grp->name = np->name;
-
 	ret = pinconf_generic_parse_dt_config(np, NULL, &configs, &nconfigs);
 	if (ret)
 		return ret;
@@ -1003,21 +998,22 @@  static int ma35_pinctrl_parse_groups(struct device_node *np, struct ma35_pin_gro
 	if (!elems)
 		return -ENOMEM;
 
+	grp->grp.name = np->name;
+
 	ret = of_property_read_u32_array(np, "nuvoton,pins", elems, count);
 	if (ret)
 		return -EINVAL;
+	grp->grp.npins = count / 3;
 
-	grp->npins = count / 3;
-
-	grp->pins = devm_kcalloc(npctl->dev, grp->npins, sizeof(*grp->pins), GFP_KERNEL);
-	if (!grp->pins)
+	pins = devm_kcalloc(npctl->dev, grp->grp.npins, sizeof(*pins), GFP_KERNEL);
+	if (!pins)
 		return -ENOMEM;
+	grp->grp.pins = pins;
 
-	grp->settings = devm_kcalloc(npctl->dev, grp->npins, sizeof(*grp->settings), GFP_KERNEL);
-	if (!grp->settings)
+	pin = devm_kcalloc(npctl->dev, grp->grp.npins, sizeof(*pin), GFP_KERNEL);
+	if (!pin)
 		return -ENOMEM;
-
-	pin = grp->settings;
+	grp->data = pin;
 
 	for (i = 0, j = 0; i < count; i += 3, j++) {
 		pin->offset = elems[i] * MA35_MFP_REG_SZ_PER_BANK + MA35_MFP_REG_BASE;
@@ -1025,7 +1021,7 @@  static int ma35_pinctrl_parse_groups(struct device_node *np, struct ma35_pin_gro
 		pin->muxval = elems[i + 2];
 		pin->configs = configs;
 		pin->nconfigs = nconfigs;
-		grp->pins[j] = npctl->info->get_pin_num(pin->offset, pin->shift);
+		pins[j] = npctl->info->get_pin_num(pin->offset, pin->shift);
 		pin++;
 	}
 	return 0;
@@ -1036,7 +1032,7 @@  static int ma35_pinctrl_parse_functions(struct device_node *np, struct ma35_pinc
 {
 	struct device_node *child;
 	struct pinfunction *func;
-	struct ma35_pin_group *grp;
+	struct group_desc *grp;
 	static u32 grp_index;
 	const char **groups;
 	u32 ret, i = 0;