drivers/pinctrl/bcm/pinctrl-ns.c:286:53: warning: passing argument 3 of 'pinmux_generic_add_function' discards 'const' qualifier from pointer target type

From: kernel test robot
Date: Wed Dec 22 2021 - 03:55:55 EST


tree: https://github.com/0day-ci/linux/commits/UPDATE-20211222-144502/Rafa-Mi-ecki/pinctrl-bcm-ns-use-generic-groups-functions-helpers/20211117-064419
head: da7c70cdea1466b4234a30658ee2b5383545a629
commit: da7c70cdea1466b4234a30658ee2b5383545a629 pinctrl: bcm: ns: use generic groups & functions helpers
date: 2 hours ago
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20211222/202112221651.gLNfcGwH-lkp@xxxxxxxxx/config)
compiler: arceb-elf-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/da7c70cdea1466b4234a30658ee2b5383545a629
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20211222-144502/Rafa-Mi-ecki/pinctrl-bcm-ns-use-generic-groups-functions-helpers/20211117-064419
git checkout da7c70cdea1466b4234a30658ee2b5383545a629
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/pinctrl/bcm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/pinctrl/bcm/pinctrl-ns.c: In function 'ns_pinctrl_probe':
>> drivers/pinctrl/bcm/pinctrl-ns.c:286:53: warning: passing argument 3 of 'pinmux_generic_add_function' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
286 | function->groups,
| ~~~~~~~~^~~~~~~~
In file included from drivers/pinctrl/bcm/pinctrl-ns.c:18:
drivers/pinctrl/bcm/../pinmux.h:153:46: note: expected 'const char **' but argument is of type 'const char * const*'
153 | const char **groups,
| ~~~~~~~~~~~~~^~~~~~


vim +286 drivers/pinctrl/bcm/pinctrl-ns.c

207
208 static int ns_pinctrl_probe(struct platform_device *pdev)
209 {
210 struct device *dev = &pdev->dev;
211 const struct of_device_id *of_id;
212 struct ns_pinctrl *ns_pinctrl;
213 struct pinctrl_desc *pctldesc;
214 struct pinctrl_pin_desc *pin;
215 struct resource *res;
216 int i;
217
218 ns_pinctrl = devm_kzalloc(dev, sizeof(*ns_pinctrl), GFP_KERNEL);
219 if (!ns_pinctrl)
220 return -ENOMEM;
221 pctldesc = &ns_pinctrl->pctldesc;
222 platform_set_drvdata(pdev, ns_pinctrl);
223
224 /* Set basic properties */
225
226 ns_pinctrl->dev = dev;
227
228 of_id = of_match_device(ns_pinctrl_of_match_table, dev);
229 if (!of_id)
230 return -EINVAL;
231 ns_pinctrl->chipset_flag = (uintptr_t)of_id->data;
232
233 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
234 "cru_gpio_control");
235 ns_pinctrl->base = devm_ioremap_resource(dev, res);
236 if (IS_ERR(ns_pinctrl->base)) {
237 dev_err(dev, "Failed to map pinctrl regs\n");
238 return PTR_ERR(ns_pinctrl->base);
239 }
240
241 memcpy(pctldesc, &ns_pinctrl_desc, sizeof(*pctldesc));
242
243 /* Set pinctrl properties */
244
245 pctldesc->pins = devm_kcalloc(dev, ARRAY_SIZE(ns_pinctrl_pins),
246 sizeof(struct pinctrl_pin_desc),
247 GFP_KERNEL);
248 if (!pctldesc->pins)
249 return -ENOMEM;
250 for (i = 0, pin = (struct pinctrl_pin_desc *)&pctldesc->pins[0];
251 i < ARRAY_SIZE(ns_pinctrl_pins); i++) {
252 const struct pinctrl_pin_desc *src = &ns_pinctrl_pins[i];
253 unsigned int chipsets = (uintptr_t)src->drv_data;
254
255 if (chipsets & ns_pinctrl->chipset_flag) {
256 memcpy(pin++, src, sizeof(*src));
257 pctldesc->npins++;
258 }
259 }
260
261 /* Register */
262
263 ns_pinctrl->pctldev = devm_pinctrl_register(dev, pctldesc, ns_pinctrl);
264 if (IS_ERR(ns_pinctrl->pctldev)) {
265 dev_err(dev, "Failed to register pinctrl\n");
266 return PTR_ERR(ns_pinctrl->pctldev);
267 }
268
269 for (i = 0; i < ARRAY_SIZE(ns_pinctrl_groups); i++) {
270 const struct ns_pinctrl_group *group = &ns_pinctrl_groups[i];
271
272 if (!(group->chipsets & ns_pinctrl->chipset_flag))
273 continue;
274
275 pinctrl_generic_add_group(ns_pinctrl->pctldev, group->name,
276 group->pins, group->num_pins, NULL);
277 }
278
279 for (i = 0; i < ARRAY_SIZE(ns_pinctrl_functions); i++) {
280 const struct ns_pinctrl_function *function = &ns_pinctrl_functions[i];
281
282 if (!(function->chipsets & ns_pinctrl->chipset_flag))
283 continue;
284
285 pinmux_generic_add_function(ns_pinctrl->pctldev, function->name,
> 286 function->groups,
287 function->num_groups, NULL);
288 }
289
290 return 0;
291 }
292

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx