[PATCH v1 2/2] gpio: xilinx: Replace custom variants of bitmap_read()/bitmap_write()

Andy Shevchenko andriy.shevchenko at linux.intel.com
Wed Feb 5 01:15:47 PST 2025


On Tue, Feb 04, 2025 at 09:00:48PM +0200, Andy Shevchenko wrote:
> Relatively recently bitmap APIs were expanded by introduction of
> bitmap_read() and bitmap_write(). These APIs are generic ones
> that may replace custom functions in this driver, i.e. xgpio_get_value32()
> and xgpio_set_value32(). Do replace them.

...

> @@ -386,13 +371,14 @@ static void xgpio_irq_mask(struct irq_data *irq_data)
>  	struct xgpio_instance *chip = irq_data_get_irq_chip_data(irq_data);
>  	int irq_offset = irqd_to_hwirq(irq_data);
>  	unsigned long bit = find_nth_bit(chip->map, 64, irq_offset);
> +	unsigned long old_enable = bitmap_read(chip->enable, round_down(bit, 32), 32);
>  	u32 mask = BIT(bit / 32), temp;
>  
>  	raw_spin_lock_irqsave(&chip->gpio_lock, flags);
>  
>  	__clear_bit(bit, chip->enable);
>  
> -	if (xgpio_get_value32(chip->enable, bit) == 0) {
> +	if (old_enable == 0) {

Oh, this one is incorrect.

>  		/* Disable per channel interrupt */
>  		temp = xgpio_readreg(chip->regs + XGPIO_IPIER_OFFSET);
>  		temp &= ~mask;

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list