linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: of: Build fails if CONFIG_OF_DYNAMIC enabled without CONFIG_OF_GPIO
@ 2020-04-25  4:46 David Gow
  2020-04-26  9:20 ` Geert Uytterhoeven
  2020-04-28 14:00 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: David Gow @ 2020-04-25  4:46 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Walleij, Frank Rowand
  Cc: linux-gpio, linux-kernel, David Gow

The symbol 'gpio_of_notifier' doesn't exist without both CONFIG_OF_GPIO
and CONFIG_OF_DYNAMIC enabled, but is referenced when only
CONFIG_OF_DYNAMIC is enabled.

This broke building with 'make ARCH=um allyesconfig':
---------------
/usr/bin/ld: drivers/gpio/gpiolib.o: in function `gpiolib_dev_init':
./drivers/gpio/gpiolib.c:5293: undefined reference to `gpio_of_notifier'
collect2: error: ld returned 1 exit status
---------------

Fixes: 63636d956c45 ("gpio: of: Add DT overlay support for GPIO hogs")
Signed-off-by: David Gow <davidgow@google.com>
---
 drivers/gpio/gpiolib.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 40f2d7f69be2..5c292fb3355c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -5289,8 +5289,9 @@ static int __init gpiolib_dev_init(void)
 	gpiolib_initialized = true;
 	gpiochip_setup_devs();
 
-	if (IS_ENABLED(CONFIG_OF_DYNAMIC))
-		WARN_ON(of_reconfig_notifier_register(&gpio_of_notifier));
+#if IS_ENABLED(CONFIG_OF_DYNAMIC) && IS_ENABLED(CONFIG_OF_GPIO)
+	WARN_ON(of_reconfig_notifier_register(&gpio_of_notifier));
+#endif /* CONFIG_OF_DYNAMIC && CONFIG_OF_GPIO */
 
 	return ret;
 }
-- 
2.26.2.303.gf8c07b1a785-goog


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

* Re: [PATCH] gpio: of: Build fails if CONFIG_OF_DYNAMIC enabled without CONFIG_OF_GPIO
  2020-04-25  4:46 [PATCH] gpio: of: Build fails if CONFIG_OF_DYNAMIC enabled without CONFIG_OF_GPIO David Gow
@ 2020-04-26  9:20 ` Geert Uytterhoeven
  2020-04-28 14:00 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2020-04-26  9:20 UTC (permalink / raw)
  To: David Gow
  Cc: Linus Walleij, Frank Rowand, open list:GPIO SUBSYSTEM,
	Linux Kernel Mailing List

Hi David,

On Sat, Apr 25, 2020 at 6:47 AM David Gow <davidgow@google.com> wrote:
> The symbol 'gpio_of_notifier' doesn't exist without both CONFIG_OF_GPIO
> and CONFIG_OF_DYNAMIC enabled, but is referenced when only
> CONFIG_OF_DYNAMIC is enabled.
>
> This broke building with 'make ARCH=um allyesconfig':

Right, so you have CONFIG_OF=y, but CONFIG_OF_GPIO=n, as the latter
depends on HAS_IOMEM, which is not set for UML.

Interestingly, the latter dependency claims to have been added because
gpiolib-of.c uses ioremap()/iounmap(). However, it seems to have never
called ioremap(), only of_iomap() and iounmap().
of_iomap() itself is available, as it depends on OF_ADDRESS, which
depends on HAS_IOMEM || UML.  Interestingly, of_iomap() calls ioremap(),
without a dependency on HAS_IOMEM?

So perhaps the dependency of CONFIG_OF_GPIO on HAS_IOMEM can be
dropped these days, solving this issue as well?

> ---------------
> /usr/bin/ld: drivers/gpio/gpiolib.o: in function `gpiolib_dev_init':
> ./drivers/gpio/gpiolib.c:5293: undefined reference to `gpio_of_notifier'
> collect2: error: ld returned 1 exit status
> ---------------
>
> Fixes: 63636d956c45 ("gpio: of: Add DT overlay support for GPIO hogs")
> Signed-off-by: David Gow <davidgow@google.com>

Anyway:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -5289,8 +5289,9 @@ static int __init gpiolib_dev_init(void)
>         gpiolib_initialized = true;
>         gpiochip_setup_devs();
>
> -       if (IS_ENABLED(CONFIG_OF_DYNAMIC))
> -               WARN_ON(of_reconfig_notifier_register(&gpio_of_notifier));
> +#if IS_ENABLED(CONFIG_OF_DYNAMIC) && IS_ENABLED(CONFIG_OF_GPIO)
> +       WARN_ON(of_reconfig_notifier_register(&gpio_of_notifier));
> +#endif /* CONFIG_OF_DYNAMIC && CONFIG_OF_GPIO */
>
>         return ret;
>  }

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] gpio: of: Build fails if CONFIG_OF_DYNAMIC enabled without CONFIG_OF_GPIO
  2020-04-25  4:46 [PATCH] gpio: of: Build fails if CONFIG_OF_DYNAMIC enabled without CONFIG_OF_GPIO David Gow
  2020-04-26  9:20 ` Geert Uytterhoeven
@ 2020-04-28 14:00 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-04-28 14:00 UTC (permalink / raw)
  To: David Gow
  Cc: Geert Uytterhoeven, Frank Rowand, open list:GPIO SUBSYSTEM, linux-kernel

On Sat, Apr 25, 2020 at 6:46 AM David Gow <davidgow@google.com> wrote:

> The symbol 'gpio_of_notifier' doesn't exist without both CONFIG_OF_GPIO
> and CONFIG_OF_DYNAMIC enabled, but is referenced when only
> CONFIG_OF_DYNAMIC is enabled.
>
> This broke building with 'make ARCH=um allyesconfig':
> ---------------
> /usr/bin/ld: drivers/gpio/gpiolib.o: in function `gpiolib_dev_init':
> ./drivers/gpio/gpiolib.c:5293: undefined reference to `gpio_of_notifier'
> collect2: error: ld returned 1 exit status
> ---------------
>
> Fixes: 63636d956c45 ("gpio: of: Add DT overlay support for GPIO hogs")
> Signed-off-by: David Gow <davidgow@google.com>

Patch applied for fixes since it fixes a regression,
I recommend looking a bit down the dependency
chain as indicated by Geert if you have time!

Yours,
Linus Walleij

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

end of thread, other threads:[~2020-04-28 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25  4:46 [PATCH] gpio: of: Build fails if CONFIG_OF_DYNAMIC enabled without CONFIG_OF_GPIO David Gow
2020-04-26  9:20 ` Geert Uytterhoeven
2020-04-28 14:00 ` 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).