Thread (47 messages) 47 messages, 9 authors, 5d ago

Re: [PATCH v7 09/15] gpiolib: regmap: add gpio_regmap_get_chip()

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2026-09-15 15:30:59
Also in: linux-clk, linux-devicetree, linux-gpio, linux-serial, lkml

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;
quoted hunk ↗ jump to hunk
 #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


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help