Re: [rfc, rft, PATCH v1 1/1] gpio: aggregator: Introduce delay support for individual output pins

From: kernel test robot
Date: Thu Jun 08 2023 - 15:45:00 EST


Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on brgl/gpio/for-next]
[also build test ERROR on linus/master v6.4-rc5 next-20230608]
[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/gpio-aggregator-Introduce-delay-support-for-individual-output-pins/20230609-002703
base: https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
patch link: https://lore.kernel.org/r/20230608162130.55015-1-andriy.shevchenko%40linux.intel.com
patch subject: [rfc, rft, PATCH v1 1/1] gpio: aggregator: Introduce delay support for individual output pins
config: hexagon-randconfig-r023-20230608 (https://download.01.org/0day-ci/archive/20230609/202306090344.UJNc4HFx-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add brgl https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
git fetch brgl gpio/for-next
git checkout brgl/gpio/for-next
b4 shazam https://lore.kernel.org/r/20230608162130.55015-1-andriy.shevchenko@xxxxxxxxxxxxxxx
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpio/

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306090344.UJNc4HFx-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from drivers/gpio/gpio-aggregator.c:26:
In file included from include/linux/gpio/driver.h:6:
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:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
547 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
560 | 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/gpio/gpio-aggregator.c:26:
In file included from include/linux/gpio/driver.h:6:
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:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
573 | 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/gpio/gpio-aggregator.c:26:
In file included from include/linux/gpio/driver.h:6:
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:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> drivers/gpio/gpio-aggregator.c:426:36: error: no member named 'of_gpio_n_cells' in 'struct gpio_chip'
426 | if (gpiospec->args_count != chip->of_gpio_n_cells)
| ~~~~ ^
>> drivers/gpio/gpio-aggregator.c:518:9: error: no member named 'of_xlate' in 'struct gpio_chip'
518 | chip->of_xlate = gpiochip_fwd_delay_of_xlate;
| ~~~~ ^
drivers/gpio/gpio-aggregator.c:519:9: error: no member named 'of_gpio_n_cells' in 'struct gpio_chip'
519 | chip->of_gpio_n_cells = 3;
| ~~~~ ^
6 warnings and 3 errors generated.


vim +426 drivers/gpio/gpio-aggregator.c

417
418 static int gpiochip_fwd_delay_of_xlate(struct gpio_chip *chip,
419 const struct of_phandle_args *gpiospec,
420 u32 *flags)
421 {
422 struct gpiochip_fwd *fwd = gpiochip_get_data(chip);
423 struct gpiochip_fwd_timing *timings;
424 u32 line;
425
> 426 if (gpiospec->args_count != chip->of_gpio_n_cells)
427 return -EINVAL;
428
429 line = gpiospec->args[0];
430 if (line >= chip->ngpio)
431 return -EINVAL;
432
433 timings = &fwd->delay_timings[line];
434 timings->ramp_up_us = gpiospec->args[1];
435 timings->ramp_down_us = gpiospec->args[2];
436
437 return line;
438 }
439
440 /**
441 * gpiochip_fwd_create() - Create a new GPIO forwarder
442 * @dev: Parent device pointer
443 * @ngpios: Number of GPIOs in the forwarder.
444 * @descs: Array containing the GPIO descriptors to forward to.
445 * This array must contain @ngpios entries, and must not be deallocated
446 * before the forwarder has been destroyed again.
447 * @delay: True if the pins have an external delay line.
448 *
449 * This function creates a new gpiochip, which forwards all GPIO operations to
450 * the passed GPIO descriptors.
451 *
452 * Return: An opaque object pointer, or an ERR_PTR()-encoded negative error
453 * code on failure.
454 */
455 static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev,
456 unsigned int ngpios,
457 struct gpio_desc *descs[],
458 bool delay)
459 {
460 const char *label = dev_name(dev);
461 struct gpiochip_fwd *fwd;
462 struct gpio_chip *chip;
463 unsigned int i;
464 int error;
465
466 fwd = devm_kzalloc(dev, struct_size(fwd, tmp, fwd_tmp_size(ngpios)),
467 GFP_KERNEL);
468 if (!fwd)
469 return ERR_PTR(-ENOMEM);
470
471 chip = &fwd->chip;
472
473 /*
474 * If any of the GPIO lines are sleeping, then the entire forwarder
475 * will be sleeping.
476 * If any of the chips support .set_config(), then the forwarder will
477 * support setting configs.
478 */
479 for (i = 0; i < ngpios; i++) {
480 struct gpio_chip *parent = gpiod_to_chip(descs[i]);
481
482 dev_dbg(dev, "%u => gpio %d irq %d\n", i,
483 desc_to_gpio(descs[i]), gpiod_to_irq(descs[i]));
484
485 if (gpiod_cansleep(descs[i]))
486 chip->can_sleep = true;
487 if (parent && parent->set_config)
488 chip->set_config = gpio_fwd_set_config;
489 }
490
491 chip->label = label;
492 chip->parent = dev;
493 chip->owner = THIS_MODULE;
494 chip->get_direction = gpio_fwd_get_direction;
495 chip->direction_input = gpio_fwd_direction_input;
496 chip->direction_output = gpio_fwd_direction_output;
497 chip->get = gpio_fwd_get;
498 chip->get_multiple = gpio_fwd_get_multiple_locked;
499 chip->set = gpio_fwd_set;
500 chip->set_multiple = gpio_fwd_set_multiple_locked;
501 chip->to_irq = gpio_fwd_to_irq;
502 chip->base = -1;
503 chip->ngpio = ngpios;
504 fwd->descs = descs;
505
506 if (chip->can_sleep)
507 mutex_init(&fwd->mlock);
508 else
509 spin_lock_init(&fwd->slock);
510
511 if (delay) {
512 fwd->delay_timings = devm_kcalloc(dev, ngpios,
513 sizeof(*fwd->delay_timings),
514 GFP_KERNEL);
515 if (!fwd->delay_timings)
516 return ERR_PTR(-ENOMEM);
517
> 518 chip->of_xlate = gpiochip_fwd_delay_of_xlate;
519 chip->of_gpio_n_cells = 3;
520 }
521
522 error = devm_gpiochip_add_data(dev, chip, fwd);
523 if (error)
524 return ERR_PTR(error);
525
526 return fwd;
527 }
528

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki