Re: [PATCH RFC 8/9] gpio: timberdale: Make irq_chip immutable

From: Andy Shevchenko
Date: Sat May 10 2025 - 14:28:19 EST


Fri, May 09, 2025 at 12:45:39PM +0800, Peng Fan (OSS) kirjoitti:
> From: Peng Fan <peng.fan@xxxxxxx>
>
> Kernel warns about mutable irq_chips:
> "not an immutable chip, please consider fixing!"
>
> Constify timbgpio_irqchip, flag the irq_chip as IRQCHIP_IMMUTABLE,
> add the new helper functions, and call the appropriate gpiolib functions.

...

> struct timbgpio *tgpio = irq_data_get_irq_chip_data(d);
> int offset = d->irq - tgpio->irq_base;
> + irq_hw_number_t hwirq = irqd_to_hwirq(d);
> unsigned long flags;

While at it, replace direct accesses to IRQ data `irq` member.

int offset = hwirq - tgpio->irq_base;

...

> static void timbgpio_irq_enable(struct irq_data *d)
> {
> struct timbgpio *tgpio = irq_data_get_irq_chip_data(d);
> int offset = d->irq - tgpio->irq_base;
> + irq_hw_number_t hwirq = irqd_to_hwirq(d);
> unsigned long flags;

Ditto.

> + gpiochip_enable_irq(&tgpio->gpio, hwirq);
> +
> spin_lock_irqsave(&tgpio->lock, flags);
> tgpio->last_ier |= 1UL << offset;
> iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);

> }

--
With Best Regards,
Andy Shevchenko