Re: [PATCH] gpio: pca953x: Add support for level-triggered interrupts

From: kernel test robot
Date: Tue Mar 18 2025 - 00:53:26 EST


Hi Potin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 2014c95afecee3e76ca4a56956a936e23283f05b]

url: https://github.com/intel-lab-lkp/linux/commits/Potin-Lai/gpio-pca953x-Add-support-for-level-triggered-interrupts/20250318-004441
base: 2014c95afecee3e76ca4a56956a936e23283f05b
patch link: https://lore.kernel.org/r/20250318-gpio-pca953x-level-triggered-irq-v1-1-0c4943d92425%40gmail.com
patch subject: [PATCH] gpio: pca953x: Add support for level-triggered interrupts
config: x86_64-buildonly-randconfig-002-20250318 (https://download.01.org/0day-ci/archive/20250318/202503181231.ZqKVm0Z8-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.0 (https://github.com/llvm/llvm-project 24a30daaa559829ad079f2ff7f73eb4e18095f88)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250318/202503181231.ZqKVm0Z8-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503181231.ZqKVm0Z8-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/gpio/gpio-pca953x.c:887:43: warning: address of array 'chip->irq_trig_level_low' will always evaluate to 'true' [-Wpointer-bool-conversion]
887 | if (!chip->irq_trig_level_high && !chip->irq_trig_level_low) {
| ~~~~~~~^~~~~~~~~~~~~~~~~~
>> drivers/gpio/gpio-pca953x.c:887:13: warning: address of array 'chip->irq_trig_level_high' will always evaluate to 'true' [-Wpointer-bool-conversion]
887 | if (!chip->irq_trig_level_high && !chip->irq_trig_level_low) {
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
2 warnings generated.


vim +887 drivers/gpio/gpio-pca953x.c

841
842 static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pending)
843 {
844 struct gpio_chip *gc = &chip->gpio_chip;
845 DECLARE_BITMAP(reg_direction, MAX_LINE);
846 DECLARE_BITMAP(old_stat, MAX_LINE);
847 DECLARE_BITMAP(cur_stat, MAX_LINE);
848 DECLARE_BITMAP(new_stat, MAX_LINE);
849 DECLARE_BITMAP(trigger, MAX_LINE);
850 DECLARE_BITMAP(edges, MAX_LINE);
851 int ret;
852
853 if (chip->driver_data & PCA_PCAL) {
854 /* Read the current interrupt status from the device */
855 ret = pca953x_read_regs(chip, PCAL953X_INT_STAT, trigger);
856 if (ret)
857 return false;
858
859 /* Check latched inputs and clear interrupt status */
860 ret = pca953x_read_regs(chip, chip->regs->input, cur_stat);
861 if (ret)
862 return false;
863
864 /* Apply filter for rising/falling edge selection */
865 bitmap_replace(new_stat, chip->irq_trig_fall, chip->irq_trig_raise, cur_stat, gc->ngpio);
866
867 bitmap_and(pending, new_stat, trigger, gc->ngpio);
868
869 return !bitmap_empty(pending, gc->ngpio);
870 }
871
872 ret = pca953x_read_regs(chip, chip->regs->input, cur_stat);
873 if (ret)
874 return false;
875
876 /* Remove output pins from the equation */
877 pca953x_read_regs(chip, chip->regs->direction, reg_direction);
878
879 bitmap_copy(old_stat, chip->irq_stat, gc->ngpio);
880
881 bitmap_and(new_stat, cur_stat, reg_direction, gc->ngpio);
882 bitmap_xor(cur_stat, new_stat, old_stat, gc->ngpio);
883 bitmap_and(trigger, cur_stat, chip->irq_mask, gc->ngpio);
884
885 bitmap_copy(chip->irq_stat, new_stat, gc->ngpio);
886
> 887 if (!chip->irq_trig_level_high && !chip->irq_trig_level_low) {
888 if (bitmap_empty(trigger, gc->ngpio))
889 return false;
890 }
891
892 bitmap_and(cur_stat, chip->irq_trig_fall, old_stat, gc->ngpio);
893 bitmap_and(old_stat, chip->irq_trig_raise, new_stat, gc->ngpio);
894 bitmap_or(edges, old_stat, cur_stat, gc->ngpio);
895 bitmap_and(pending, edges, trigger, gc->ngpio);
896
897 bitmap_and(cur_stat, new_stat, chip->irq_trig_level_high, gc->ngpio);
898 bitmap_and(cur_stat, cur_stat, chip->irq_mask, gc->ngpio);
899 bitmap_or(pending, pending, cur_stat, gc->ngpio);
900
901 bitmap_complement(cur_stat, new_stat, gc->ngpio);
902 bitmap_and(cur_stat, cur_stat, reg_direction, gc->ngpio);
903 bitmap_and(old_stat, cur_stat, chip->irq_trig_level_low, gc->ngpio);
904 bitmap_and(old_stat, old_stat, chip->irq_mask, gc->ngpio);
905 bitmap_or(pending, pending, old_stat, gc->ngpio);
906
907 return !bitmap_empty(pending, gc->ngpio);
908 }
909

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