[v9,01/22] gpio: guard gpiochip_irqchip_add_domain() with GPIOLIB_IRQCHIP

Message ID 20210324081923.20379-2-noltari@gmail.com
State New
Headers show
Series
  • pinctrl: add BCM63XX pincontrol support
Related show

Commit Message

Álvaro Fernández Rojas March 24, 2021, 8:19 a.m.
The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in
a compilation error when trying to build gpio-regmap if CONFIG_GPIOLIB_IRQCHIP
isn't enabled.

Fixes: 6a45b0e2589f ("gpiolib: Introduce gpiochip_irqchip_add_domain()")
Suggested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Michael Walle <michael@walle.cc>
---
 v9: no changes
 v8: no changes
 v7: no changes
 v6: no changes
 v5: add missing Suggested-by tag
 v4: add patch (fix include instead of gpio-regmap.c)

 include/linux/gpio/driver.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Bartosz Golaszewski March 26, 2021, 1:14 p.m. | #1
On Wed, Mar 24, 2021 at 9:19 AM Álvaro Fernández Rojas
<noltari@gmail.com> wrote:
>
> The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in
> a compilation error when trying to build gpio-regmap if CONFIG_GPIOLIB_IRQCHIP
> isn't enabled.
>
> Fixes: 6a45b0e2589f ("gpiolib: Introduce gpiochip_irqchip_add_domain()")
> Suggested-by: Michael Walle <michael@walle.cc>
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Reviewed-by: Michael Walle <michael@walle.cc>
> ---

Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

I suppose this will go through the pinctrl tree.

Bartosz
Linus Walleij March 29, 2021, 10:24 a.m. | #2
On Fri, Mar 26, 2021 at 2:14 PM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:

> I suppose this will go through the pinctrl tree.


Yups I applied them.

To make things mess-resistant I have applied them on an
immutable branch and then merged that to devel:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/log/?h=ib-bcm63xx

If we get problems between GPIO and pin control you can
pull this in, but let's hope not!

Yours,
Linus Walleij

Patch

diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 286de0520574..ecf0032a0995 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -624,8 +624,17 @@  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)
+{
+	WARN_ON(1);
+	return -EINVAL;
+}
+#endif
 
 int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset);
 void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset);