diff mbox series

[v2,07/11] pinctrl: imx: Convert to use func member

Message ID 20240528194951.1489887-8-andy.shevchenko@gmail.com (mailing list archive)
State New
Headers show
Series pinctrl: pinmux: Embed and reuse struct pinfunction | expand

Commit Message

Andy Shevchenko May 28, 2024, 7:44 p.m. UTC
Convert drivers to use func member embedded in struct function_desc,
because other members will be removed to avoid duplication and
desynchronisation of the generic pin function description.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/pinctrl/freescale/pinctrl-imx.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

kernel test robot May 30, 2024, 4:27 a.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 linus/master v6.10-rc1 next-20240529]
[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-berlin-Make-use-of-struct-pinfunction/20240529-035554
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link:    https://lore.kernel.org/r/20240528194951.1489887-8-andy.shevchenko%40gmail.com
patch subject: [PATCH v2 07/11] pinctrl: imx: Convert to use func member
config: microblaze-allyesconfig (https://download.01.org/0day-ci/archive/20240530/202405301147.XaijPkPT-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240530/202405301147.XaijPkPT-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/202405301147.XaijPkPT-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/pinctrl/freescale/pinctrl-imx.c: In function 'imx_pinctrl_parse_functions':
>> drivers/pinctrl/freescale/pinctrl-imx.c:603:52: error: 'struct function_desc' has no member named 'ngroups'
     603 |         group_names = devm_kcalloc(ipctl->dev, func->ngroups, sizeof(*func->func.groups),
         |                                                    ^~


vim +603 drivers/pinctrl/freescale/pinctrl-imx.c

   577	
   578	static int imx_pinctrl_parse_functions(struct device_node *np,
   579					       struct imx_pinctrl *ipctl,
   580					       u32 index)
   581	{
   582		struct pinctrl_dev *pctl = ipctl->pctl;
   583		struct device_node *child;
   584		struct function_desc *func;
   585		struct group_desc *grp;
   586		const char **group_names;
   587		u32 i;
   588	
   589		dev_dbg(pctl->dev, "parse function(%d): %pOFn\n", index, np);
   590	
   591		func = pinmux_generic_get_function(pctl, index);
   592		if (!func)
   593			return -EINVAL;
   594	
   595		/* Initialise function */
   596		func->func.name = np->name;
   597		func->func.ngroups = of_get_child_count(np);
   598		if (func->func.ngroups == 0) {
   599			dev_info(ipctl->dev, "no groups defined in %pOF\n", np);
   600			return -EINVAL;
   601		}
   602	
 > 603		group_names = devm_kcalloc(ipctl->dev, func->ngroups, sizeof(*func->func.groups),
   604					   GFP_KERNEL);
   605		if (!group_names)
   606			return -ENOMEM;
   607		i = 0;
   608		for_each_child_of_node(np, child)
   609			group_names[i++] = child->name;
   610		func->func.groups = group_names;
   611	
   612		i = 0;
   613		for_each_child_of_node(np, child) {
   614			grp = devm_kzalloc(ipctl->dev, sizeof(*grp), GFP_KERNEL);
   615			if (!grp) {
   616				of_node_put(child);
   617				return -ENOMEM;
   618			}
   619	
   620			mutex_lock(&ipctl->mutex);
   621			radix_tree_insert(&pctl->pin_group_tree,
   622					  ipctl->group_index++, grp);
   623			mutex_unlock(&ipctl->mutex);
   624	
   625			imx_pinctrl_parse_groups(child, grp, ipctl, i++);
   626		}
   627	
   628		return 0;
   629	}
   630
diff mbox series

Patch

diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 2d3d80921c0d..44921e3bdb94 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -266,7 +266,7 @@  static int imx_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
 	npins = grp->grp.npins;
 
 	dev_dbg(ipctl->dev, "enable function %s group %s\n",
-		func->name, grp->grp.name);
+		func->func.name, grp->grp.name);
 
 	for (i = 0; i < npins; i++) {
 		/*
@@ -593,21 +593,21 @@  static int imx_pinctrl_parse_functions(struct device_node *np,
 		return -EINVAL;
 
 	/* Initialise function */
-	func->name = np->name;
-	func->num_group_names = of_get_child_count(np);
-	if (func->num_group_names == 0) {
+	func->func.name = np->name;
+	func->func.ngroups = of_get_child_count(np);
+	if (func->func.ngroups == 0) {
 		dev_info(ipctl->dev, "no groups defined in %pOF\n", np);
 		return -EINVAL;
 	}
 
-	group_names = devm_kcalloc(ipctl->dev, func->num_group_names,
-				   sizeof(char *), GFP_KERNEL);
+	group_names = devm_kcalloc(ipctl->dev, func->ngroups, sizeof(*func->func.groups),
+				   GFP_KERNEL);
 	if (!group_names)
 		return -ENOMEM;
 	i = 0;
 	for_each_child_of_node(np, child)
 		group_names[i++] = child->name;
-	func->group_names = group_names;
+	func->func.groups = group_names;
 
 	i = 0;
 	for_each_child_of_node(np, child) {