Re:Re: [PATCH v12 09/11] gpio: pl061: switch data path to gpio-regmap

From: zl020895

Date: Tue Oct 27 2026 - 06:32:55 EST


At 2026-10-27 16:06:15, "Andy Shevchenko" <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>On Tue, Oct 27, 2026 at 12:18:56PM +0800, Long Zhao via B4 Relay wrote:
>
>> + if (irq) {
>> + irq_set_chained_handler_and_data(irq, pl061_irq_handler, pl061);
>
>> + pl061->irq_handler_installed = true;
>
>Can't we remove the chained handler unconditionally?
>
>> + }
>
>--
>With Best Regards,
>Andy Shevchenko
>

Hi Andy,

Thanks for the review.

On the chained-handler teardown: pl061_remove_irq() is registered
before devm_gpio_regmap_register(), so on unbind it runs after
gpiochip_remove(). gpiochip_free_remaining_irqs() therefore still
sees the irq domain and its mappings; the action then disposes
them. The chained handler is installed only after
devm_gpio_regmap_register() succeeds. If that call fails, the
action still runs although no handler was installed, which is
why irq_handler_installed exists.

Options for v13:
A) Keep irq_handler_installed and document this ordering.
B) Split into two devm actions. The early one, still registered
before the gpiochip, only calls irq_dispose_mapping(), so
unbind order is unchanged. A second action, registered right
after irq_set_chained_handler_and_data(), clears the handler
unconditionally, and the flag goes away.

Do you prefer A or B?

Best regards,
Long Zhao