linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: regmap: disable IRQ domain without GPIOLIB_IRQCHIP
@ 2021-03-04  7:05 Álvaro Fernández Rojas
  2021-03-04  8:29 ` Michael Walle
  0 siblings, 1 reply; 3+ messages in thread
From: Álvaro Fernández Rojas @ 2021-03-04  7:05 UTC (permalink / raw)
  To: Michael Walle, Linus Walleij, Bartosz Golaszewski,
	Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Álvaro Fernández Rojas

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.

Fixes: ebe363197e52 ("gpio: add a reusable generic gpio_chip using regmap")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/gpio/gpio-regmap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 5412cb3b0b2a..fed1e269c42a 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -279,16 +279,20 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	if (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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: regmap: disable IRQ domain without GPIOLIB_IRQCHIP
  2021-03-04  7:05 [PATCH] gpio: regmap: disable IRQ domain without GPIOLIB_IRQCHIP Álvaro Fernández Rojas
@ 2021-03-04  8:29 ` Michael Walle
  2021-03-04  8:54   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Walle @ 2021-03-04  8:29 UTC (permalink / raw)
  To: Álvaro Fernández Rojas
  Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, linux-gpio,
	linux-kernel

Am 2021-03-04 08:05, schrieb Álvaro Fernández Rojas:
> 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.
> 
> Fixes: ebe363197e52 ("gpio: add a reusable generic gpio_chip using 
> regmap")
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>

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.

--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: regmap: disable IRQ domain without GPIOLIB_IRQCHIP
  2021-03-04  8:29 ` Michael Walle
@ 2021-03-04  8:54   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2021-03-04  8:54 UTC (permalink / raw)
  To: Michael Walle
  Cc: Álvaro Fernández Rojas, Bartosz Golaszewski,
	Andy Shevchenko, open list:GPIO SUBSYSTEM, linux-kernel

On Thu, Mar 4, 2021 at 9:29 AM Michael Walle <michael@walle.cc> wrote:
> Am 2021-03-04 08:05, schrieb Álvaro Fernández Rojas:

> > 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.
> >
> > Fixes: ebe363197e52 ("gpio: add a reusable generic gpio_chip using
> > regmap")
> > Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
>
> 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.
>
> --- a/include/linux/gpio/driver.h
> +++ b/include/linux/gpio/driver.h
> @@ -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?

Oh that is a better fix. Please go with this Álvaro!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-04  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04  7:05 [PATCH] gpio: regmap: disable IRQ domain without GPIOLIB_IRQCHIP Álvaro Fernández Rojas
2021-03-04  8:29 ` Michael Walle
2021-03-04  8:54   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).