[PATCH v2 12/16] pinctrl: starfive: Add pinctrl driver for StarFive SoCs

kernel test robot lkp at intel.com
Thu Oct 28 13:17:13 PDT 2021


Hi Emil,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20211021]
[also build test ERROR on v5.15-rc7]
[cannot apply to robh/for-next clk/clk-next pza/reset/next linus/master v5.15-rc6 v5.15-rc5 v5.15-rc4]
[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]

url:    https://github.com/0day-ci/linux/commits/Emil-Renner-Berthing/Basic-StarFive-JH7100-RISC-V-SoC-support/20211022-014605
base:    3196a52aff93186897f15f1a6c03220ce6523d82
config: alpha-randconfig-p002-20211028 (attached as .config)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/2aa8169a8c5820ad5b70679777e7f6acd4fd4699
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Emil-Renner-Berthing/Basic-StarFive-JH7100-RISC-V-SoC-support/20211022-014605
        git checkout 2aa8169a8c5820ad5b70679777e7f6acd4fd4699
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=alpha 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   drivers/pinctrl/pinctrl-starfive.c: In function 'starfive_dt_node_to_map':
>> drivers/pinctrl/pinctrl-starfive.c:591:23: error: implicit declaration of function 'pinconf_generic_parse_dt_config'; did you mean 'pinconf_generic_dump_config'? [-Werror=implicit-function-declaration]
     591 |                 ret = pinconf_generic_parse_dt_config(child, pctldev,
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                       pinconf_generic_dump_config
   cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for OF_GPIO
   Depends on GPIOLIB && OF && HAS_IOMEM
   Selected by
   - PINCTRL_STARFIVE && PINCTRL && (SOC_STARFIVE || COMPILE_TEST
   WARNING: unmet direct dependencies detected for GPIO_SYSCON
   Depends on GPIOLIB && HAS_IOMEM && MFD_SYSCON && OF
   Selected by
   - GPIO_SAMA5D2_PIOBU && GPIOLIB && HAS_IOMEM && MFD_SYSCON && OF_GPIO


vim +591 drivers/pinctrl/pinctrl-starfive.c

   475	
   476	static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev,
   477					   struct device_node *np,
   478					   struct pinctrl_map **maps,
   479					   unsigned int *num_maps)
   480	{
   481		struct starfive_pinctrl *sfp = pinctrl_dev_get_drvdata(pctldev);
   482		struct device *dev = starfive_dev(sfp);
   483		const char **pgnames;
   484		struct pinctrl_map *map;
   485		struct device_node *child;
   486		const char *grpname;
   487		int *pins;
   488		u32 *pinmux;
   489		int nmaps;
   490		int ngroups;
   491		int ret;
   492	
   493		nmaps = 0;
   494		ngroups = 0;
   495		for_each_child_of_node(np, child) {
   496			int npinmux = of_property_count_u32_elems(child, "pinmux");
   497			int npins   = of_property_count_u32_elems(child, "pins");
   498	
   499			if (npinmux > 0 && npins > 0) {
   500				dev_err(dev, "invalid pinctrl group %pOFn.%pOFn: %s\n",
   501					np, child, "both pinmux and pins set");
   502				of_node_put(child);
   503				return -EINVAL;
   504			}
   505	
   506			if (npinmux > 0) {
   507				nmaps += 2;
   508			} else if (npins > 0) {
   509				nmaps += 1;
   510			} else {
   511				dev_err(dev, "invalid pinctrl group %pOFn.%pOFn: %s\n",
   512					np, child, "neither pinmux nor pins set");
   513				of_node_put(child);
   514				return -EINVAL;
   515			}
   516			ngroups += 1;
   517		}
   518	
   519		ret = -ENOMEM;
   520		pgnames = devm_kcalloc(dev, ngroups, sizeof(*pgnames), GFP_KERNEL);
   521		if (!pgnames)
   522			return ret;
   523	
   524		map = kcalloc(nmaps, sizeof(*map), GFP_KERNEL);
   525		if (!map)
   526			goto free_pgnames;
   527	
   528		nmaps = 0;
   529		ngroups = 0;
   530		for_each_child_of_node(np, child) {
   531			int npins;
   532			int i;
   533	
   534			ret = -ENOMEM;
   535			grpname = devm_kasprintf(dev, GFP_KERNEL, "%s.%s", np->name, child->name);
   536			if (!grpname)
   537				goto put_child;
   538	
   539			pgnames[ngroups++] = grpname;
   540	
   541			if ((npins = of_property_count_u32_elems(child, "pinmux")) > 0) {
   542				pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL);
   543				if (!pins)
   544					goto free_grpname;
   545	
   546				pinmux = devm_kcalloc(dev, npins, sizeof(*pinmux), GFP_KERNEL);
   547				if (!pinmux)
   548					goto free_pins;
   549	
   550				for (i = 0; i < npins; i++) {
   551					u32 v;
   552	
   553					ret = of_property_read_u32_index(child, "pinmux", i, &v);
   554					if (ret)
   555						goto free_pinmux;
   556					pins[i] = starfive_gpio_to_pin(sfp, starfive_pinmux_to_gpio(v));
   557					pinmux[i] = v;
   558				}
   559	
   560				map[nmaps].type = PIN_MAP_TYPE_MUX_GROUP;
   561				map[nmaps].data.mux.function = np->name;
   562				map[nmaps].data.mux.group = grpname;
   563				nmaps += 1;
   564			} else if ((npins = of_property_count_u32_elems(child, "pins")) > 0) {
   565				pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL);
   566				if (!pins)
   567					goto free_grpname;
   568	
   569				pinmux = NULL;
   570	
   571				for (i = 0; i < npins; i++) {
   572					u32 v;
   573	
   574					ret = of_property_read_u32_index(child, "pins", i, &v);
   575					if (ret)
   576						goto free_pins;
   577					pins[i] = v;
   578				}
   579			} else {
   580				ret = -EINVAL;
   581				goto free_grpname;
   582			}
   583	
   584			ret = pinctrl_generic_add_group(pctldev, grpname, pins, npins, pinmux);
   585			if (ret < 0) {
   586				dev_err(dev, "error adding group %pOFn.%pOFn: %d\n",
   587					np, child, ret);
   588				goto free_pinmux;
   589			}
   590	
 > 591			ret = pinconf_generic_parse_dt_config(child, pctldev,
   592							      &map[nmaps].data.configs.configs,
   593							      &map[nmaps].data.configs.num_configs);
   594			if (ret) {
   595				dev_err(dev, "invalid pinctrl group %pOFn.%pOFn: %s\n",
   596					np, child, "error parsing pin config");
   597				goto put_child;
   598			}
   599	
   600			/* don't create a map if there are no pinconf settings */
   601			if (map[nmaps].data.configs.num_configs == 0)
   602				continue;
   603	
   604			map[nmaps].type = PIN_MAP_TYPE_CONFIGS_GROUP;
   605			map[nmaps].data.configs.group_or_pin = grpname;
   606			nmaps += 1;
   607		}
   608	
   609		ret = pinmux_generic_add_function(pctldev, np->name, pgnames, ngroups, NULL);
   610		if (ret < 0) {
   611			dev_err(dev, "error adding function %pOFn: %d\n", np, ret);
   612			goto free_map;
   613		}
   614	
   615		*maps = map;
   616		*num_maps = nmaps;
   617		return 0;
   618	
   619	free_pinmux:
   620		devm_kfree(dev, pinmux);
   621	free_pins:
   622		devm_kfree(dev, pins);
   623	free_grpname:
   624		devm_kfree(dev, grpname);
   625	put_child:
   626		of_node_put(child);
   627	free_map:
   628		pinctrl_utils_free_map(pctldev, map, nmaps);
   629	free_pgnames:
   630		devm_kfree(dev, pgnames);
   631		return ret;
   632	}
   633	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32651 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20211029/27d79e9a/attachment.gz>


More information about the linux-riscv mailing list