On 1 August 2018 at 22:44, Christian Lamparter <[email protected]> wrote: > On Wednesday, August 1, 2018 3:21:00 PM CEST Jonas Gorski wrote: >> On 30 July 2018 at 22:35, John Crispin <[email protected]> wrote: >> > On 30/07/18 22:33, Christian Lamparter wrote: >> >> >> >> This patch fixes the a compile issue that was triggered by >> >> apm821xx/sata when kmod-regmap was selected. >> >> >> >> The CONFIG_REGMAP is declared in drivers/base/regmap/Kconfig >> >> as type "bool" and not "tristate". Hence the symbol should >> >> never be set to module, as this confuses the #if CONFIG_REGMAP >> >> guards in include/linux/regmap.h: >> >> >> >> |.../drivers/regulator/core.c:4041: undefined reference to >> >> `dev_get_regmap' >> >> |.../drivers/regulator/core.c:4042: undefined reference to >> >> `dev_get_regmap' >> >> |.../drivers/regulator/core.c:4044: undefined reference to >> >> `dev_get_regmap' >> >> |.../drivers/regulator/helpers.o: In function >> >> `regulator_is_enabled_regmap': >> >> |.../drivers/regulator/helpers.c:36: undefined reference to `regmap_read' >> >> |... >> > >> > i started a test build 2 minutes ago to figure this one out :-) thanks ! >> >> This is actually the wrong fix and papers over an issue in one of our >> local patches. >> >> We intentionally allow regmap to be built as a module, see >> >> https://github.com/openwrt/openwrt/blob/master/target/linux/generic/hack-4.14/259-regmap_dynamic.patch >> >> So there are likely some additional EXPORT_SYMBOL_GPL()s required instead. > > Thanks for FYI, I missed this patch completely. > > I found that the issue lies in the upstream regulator core code. > It is using these regmap's functions. And the CONFIG_REGULATOR symbol that > pulls > in the core's code is sadly a bool menuconfig option... so CONFIG_REGMAP > pretty > much becomes a requirement/select for the REGULATOR.
This is one of the more trickier variants, it optionally supports regmap thanks to the stubs provided if regmap is disabled - which breaks if you compile regmap as a module. I expect this to happen more in the future. This is a bit tricky to solve. We can't just generally stub out the regmap stuff unless compiled in, as a lot of regulators depend on it. A proper fix is likely a bit more work (as usual). > > --- > diff --git a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch > b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch > index 1c6e78df30..35803c3181 100644 > --- a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch > +++ b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch > @@ -9,8 +9,9 @@ Signed-off-by: Felix Fietkau <[email protected]> > drivers/base/regmap/Kconfig | 15 ++++++++++----- > drivers/base/regmap/Makefile | 12 ++++++++---- > drivers/base/regmap/regmap.c | 3 +++ > + drivers/regulator/Kconfig | 1 + > include/linux/regmap.h | 2 +- > - 4 files changed, 22 insertions(+), 10 deletions(-) > + 5 files changed, 23 insertions(+), 10 deletions(-) > > --- a/drivers/base/regmap/Kconfig > +++ b/drivers/base/regmap/Kconfig > @@ -96,6 +97,15 @@ Signed-off-by: Felix Fietkau <[email protected]> > postcore_initcall(regmap_initcall); > + > +MODULE_LICENSE("GPL"); > +--- a/drivers/regulator/Kconfig > ++++ b/drivers/regulator/Kconfig > +@@ -1,5 +1,6 @@ > + menuconfig REGULATOR > + bool "Voltage and Current Regulator Support" > ++ select REGMAP This will cause REGMAP to be included regardless if needed or not, but would be acceptable (at least to me) as an interim build fix (most targets using REGULATORs likely won't be part of the 4/32 gang anyway). The correct fix is likely to a) add this REGMAP select to all REGULATOR drivers depending on/using it (this can probably even be upstreamed) b) (OpenWrt only) Change the usage in regulator/core.c and regulator/helper.c to work like REGMAP is disabled if it is build as a module. b) is to allow building REGMAP as =m even when REGULATOR is enabled, if no REGMAP requiring REGULATOR driver is enabled. regards Jonas _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
