]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: xilinx: drop bitmap_complement() where feasible
authorYury Norov <ynorov@nvidia.com>
Fri, 17 Apr 2026 17:59:54 +0000 (13:59 -0400)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Thu, 23 Apr 2026 07:53:57 +0000 (09:53 +0200)
The driver reproduces the following pattern:

bitmap_complement(tmp, data1, nbits);
bitmap_and(dst, data2, tmp, nbits);

This can be done in a single pass:

bitmap_andnot(dst, data2, data1, nbits);

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Link: https://patch.msgid.link/20260417175955.375275-3-ynorov@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-xilinx.c

index be4b4d73054775316b9cb7fdc5d9f79a08ed93bf..532205175827a0915c3b6ee3d8fec2895d4bd760 100644 (file)
@@ -495,13 +495,11 @@ static void xgpio_irqhandler(struct irq_desc *desc)
 
        xgpio_read_ch_all(chip, XGPIO_DATA_OFFSET, hw);
 
-       bitmap_complement(rising, chip->last_irq_read, 64);
-       bitmap_and(rising, rising, hw, 64);
+       bitmap_andnot(rising, hw, chip->last_irq_read, 64);
        bitmap_and(rising, rising, chip->enable, 64);
        bitmap_and(rising, rising, chip->rising_edge, 64);
 
-       bitmap_complement(falling, hw, 64);
-       bitmap_and(falling, falling, chip->last_irq_read, 64);
+       bitmap_andnot(falling, chip->last_irq_read, hw, 64);
        bitmap_and(falling, falling, chip->enable, 64);
        bitmap_and(falling, falling, chip->falling_edge, 64);