Hi, >> +static struct irq_domain *rtd1625_gpio_create_irq_domain(struct gpio_regmap *gpio_reg) >> +{ >> + struct rtd1625_gpio *data = gpio_regmap_get_drvdata(gpio_reg); >> + struct device *dev = regmap_get_device(data->regmap); >> + struct irq_domain_info d_info = {}; >> + >> + d_info.fwnode = dev_fwnode(dev); >> + d_info.size = data->info->num_gpios; >> + d_info.hwirq_max = data->info->num_gpios; >> + d_info.ops = &rtd1625_gpio_irq_domain_ops; >> + d_info.host_data = gpio_reg; >> + >> + data->domain = irq_domain_instantiate(&d_info); >> + if (IS_ERR(data->domain)) >> + return data->domain; > > This is open coded irq_domain_create_linear(). The only difference is that we > propagate the underneath error code instead of decoding NULL as ENOMEM or > EINVAL or something like that. If this is the case, add a comment explaining > why, otherwise somebody will change that in the future w/o much thinking. Yes! I'm going to use irq_domain_create_linear(). > > Note, it was open coded since there is no devm_*() helper for that. > >> + for (unsigned int i = 0; i < RTD1625_MAX_IRQS; i++) { >> + if (data->irqs[i]) >> + irq_set_chained_handler_and_data(data->irqs[i], >> + rtd1625_gpio_irq_handle, >> + data); >> + } >> + >> + return data->domain; >> +} > > ... > >> +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? 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. -michael > >> + 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); >> +}