gpio: regmap: disable IRQ domain without GPIOLIB_IRQCHIP
Subsystems (2)
PATCH 1/1 gpio: regmap: disable IRQ domain without GPIOLIB_IRQCHIP
The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in a compilation error when trying to build gpio-regmap without having selected CONFIG_GPIOLIB_IRQCHIP.
--- drivers/gpio/gpio-regmap.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpio/gpio-regmap.c +4 -0
@@ -279,16 +279,20 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *configif (ret <0 ) goto err_free_gpio; +#ifdef CONFIG_GPIOLIB_IRQCHIP if (config->irq_domain) { ret =gpiochip_irqchip_add_domain (chip, config->irq_domain);if (ret) goto err_remove_gpiochip; } +#endif /* CONFIG_GPIOLIB_IRQCHIP */ return gpio; +#ifdef CONFIG_GPIOLIB_IRQCHIP err_remove_gpiochip:gpiochip_remove (chip); +#endif /* CONFIG_GPIOLIB_IRQCHIP */ err_free_gpio:kfree (gpio);return ERR_PTR (ret);
Signature · 1 line
2.20.1
Am 2021-03-04 08:05, schrieb Álvaro Fernández Rojas:
Quoted 6 lines
The current code doesn't check if
GPIOLIB_IRQCHIPis enabled, which results in a compilation error when trying to build gpio-regmap without having selectedCONFIG_GPIOLIB_IRQCHIP.Fixes ebe363197e52 ("gpio: add a reusable generic gpio_chip using regmap")Signed-off-by Álvaro Fernández Rojas <[email protected]>
Nice catch.
However, instead of having that ifdef, commit 6a45b0e2589f ("gpiolib:
Introduce gpiochip_irqchip_add_domain()") could be fixed. That one is missing a stub if CONFIG_GPIOLIB_IRQCHIP is not defined.
include/linux/gpio/driver.h +8 -0
@@ -624,8 +624,16 @@ void gpiochip_irq_domain_deactivate(struct irq_domain *domain,bool gpiochip_irqchip_irq_valid (const struct gpio_chip *gc,unsigned int offset); +#ifdef CONFIG_GPIOLIB_IRQCHIP int gpiochip_irqchip_add_domain (struct gpio_chip *gc,struct irq_domain *domain); +#else +static inline int gpiochip_irqchip_add_domain (struct gpio_chip *gc, +struct irq_domain *domain) +{ +return 0 ; +} +#endif /* CONFIG_GPIOLIB_IRQCHIP */
Linus, do you agree?
-michael
Quoted 36 lines · Michael Walle
Am 2021-03-04 08:05, schrieb Álvaro Fernández Rojas:
Quoted 9 lines
The current code doesn't check if
GPIOLIB_IRQCHIPis enabled, which results in
a compilation error when trying to build gpio-regmap without having selectedCONFIG_GPIOLIB_IRQCHIP.Fixes ebe363197e52 ("gpio: add a reusable generic gpio_chip usingregmap")
Signed-off-by Álvaro Fernández Rojas <[email protected]>Nice catch.
However, instead of having that ifdef, commit
6a45b0e2589f("gpiolib:
Introducegpiochip_irqchip_add_domain()") could be fixed. That one is missing a stub ifCONFIG_GPIOLIB_IRQCHIPis not defined.include/linux/gpio/driver.h +8
-0@@ -624,8 +624,16 @@ void gpiochip_irq_domain_deactivate(structirq_domain *domain, bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc,unsigned int offset); +#ifdef CONFIG_GPIOLIB_IRQCHIP int gpiochip_irqchip_add_domain (struct gpio_chip *gc,struct irq_domain *domain); +#else +static inline int gpiochip_irqchip_add_domain (struct gpio_chip *gc, +struct irq_domain *domain) +{ +return 0 ; +} +#endif /* CONFIG_GPIOLIB_IRQCHIP */
Quoted 1 line
Linus, do you agree?
Oh that is a better fix. Please go with this Álvaro!
Yours,
Linus Walleij