gpio: of: Build fails if CONFIG_OF_DYNAMIC enabled without CONFIG_OF_GPIO
PATCH 1/1 gpio: of: Build fails if CONFIG_OF_DYNAMIC enabled without CONFIG_OF_GPIO
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
---------------
--- drivers/gpio/gpiolib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib.c +3 -2
@@ -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; }
Signature · 1 line
2.26.2.303.gf8c07b1a785-goog
Hi David,
Quoted 5 lines · David Gow
The symbol '
gpio_of_notifier' doesn't exist without bothCONFIG_OF_GPIOandCONFIG_OF_DYNAMICenabled, but is referenced when onlyCONFIG_OF_DYNAMICis 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?
Quoted 8 lines
---------------
/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 <[email protected]>
Anyway:
Quoted 4 lines
drivers/gpio/gpiolib.c +0
-0@@ -5289,8 +5289,9 @@ static int __init gpiolib_dev_init(void) gpiolib_initialized = true;
drivers/gpio/gpiolib.c static int __init gpiolib_dev_init(void) · line 5297
Quoted 10 lines
drivers/gpio/gpiolib.c +3
-2gpiochip_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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Quoted 11 lines · David Gow
The symbol '
gpio_of_notifier' doesn't exist without bothCONFIG_OF_GPIOandCONFIG_OF_DYNAMICenabled, but is referenced when onlyCONFIG_OF_DYNAMICis 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
---------------
Quoted 2 lines
Fixes 63636d956c45 ("gpio: of: Add DT overlay support for GPIO hogs")Signed-off-by David Gow <[email protected]>
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