Re: [PATCH v7 09/15] gpiolib: regmap: add gpio_regmap_get_chip()
From: Andy Shevchenko
Date: Tue Sep 15 2026 - 11:40:26 EST
On Tue, Sep 15, 2026 at 07:15:39PM +0800, Long Zhao via B4 Relay wrote:
> Let drivers that implement a custom irqchip retrieve the gpio_chip
> after registration. Attach a caller-provided irq_domain only when it
> is present.
...
> struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config)
> {
> - struct irq_domain *irq_domain;
> struct gpio_regmap *gpio;
> struct gpio_chip *chip;
> int ret;
> #ifdef CONFIG_REGMAP_IRQ
> if (config->regmap_irq_chip) {
> + struct irq_domain *irq_domain;
> +
> gpio->regmap_irq_line = config->regmap_irq_line;
> ret = regmap_add_irq_chip_fwnode(dev_fwnode(config->parent), config->regmap,
> config->regmap_irq_line, config->regmap_irq_flags,
> @@ -420,12 +427,15 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
> goto err_remove_gpiochip;
>
> irq_domain = regmap_irq_get_domain(gpio->irq_chip_data);
> + if (irq_domain) {
> + ret = gpiochip_irqchip_add_domain(chip, irq_domain);
> + if (ret)
> + goto err_remove_gpiochip;
> + }
> } else
> #endif
> - irq_domain = config->irq_domain;
> -
> - if (irq_domain) {
> - ret = gpiochip_irqchip_add_domain(chip, irq_domain);
> + if (config->irq_domain) {
> + ret = gpiochip_irqchip_add_domain(chip, config->irq_domain);
> if (ret)
> goto err_remove_gpiochip;
> }
I do not understand how it's different from the original one. Can you elaborate?
--
With Best Regards,
Andy Shevchenko