[RFT PATCH v2 04/14] gpio: rtd1625: create the IRQ domain from the gpio-regmap callback

Andy Shevchenko andriy.shevchenko at linux.intel.com
Thu Dec 3 02:20:32 PST 2026


On Mon, Nov 30, 2026 at 03:37:17PM +0100, Michael Walle wrote:

...

> >> +static void rtd1625_gpio_remove_irq_domain(struct gpio_regmap *gpio_reg)
> >> +{
> >> +	struct rtd1625_gpio *data = gpio_regmap_get_drvdata(gpio_reg);
> >> +
> >> +	for (unsigned int i = 0; i < RTD1625_MAX_IRQS; i++) {
> >
> >> +		if (data->irqs[i])
> >
> > Do you need this? It seems to me that irq_to_desc() returns NULL
> > and scoped_irqdesc_get_and_buslock() does nothing. Yes, I know
> > it's a tricky code.
> 
> Maybe, but I couldn't find any code already relying on that. So do
> we really want to do that here?

Because nobody before really went via the macro jungle to understand
the behaviour? It took me half an hour to hour to get it, actually.

> Alternatively, we could add num_irqs to struct rtd1625_gpio and just
> end the for loop at that boundary. But I'm not sure that's worth it.
> 
> I don't care too much. I'm fine either way, but I haven't looked too
> closely if passing 0 as irq is fine.

This depends on the IRQ == 0 valid or invalid. In Linux we consider IRQ == 0
as NOIRQ.  Do we have some specific code that break this?

> >> +			irq_set_chained_handler_and_data(data->irqs[i], NULL, NULL);
> >> +	}
> >> +
> >> +	for (irq_hw_number_t hwirq = 0; hwirq < data->info->num_gpios; hwirq++)
> >> +		irq_dispose_mapping(irq_find_mapping(data->domain, hwirq));
> >> +
> >> +	irq_domain_remove(data->domain);
> >> +}

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list