build error with CONFIG_REGMAP=m and CONFIG_REGULATOR=y

From: Hauke Mehrtens
Date: Sun Nov 17 2013 - 10:07:07 EST


Hi,

In OpenWrt we are seeing some build errors when CONFIG_REGMAP=m and
CONFIG_REGULATOR=y are set.

/drivers/regulator/core.c accesses some regmap functions, but they are
compiled into a module and not into a kernel. When CONFIG_REGMAP is not
set the header file replaces the functions with empty static inline
functions.

With kernel 3.10.18 I see the following build error:

drivers/built-in.o: In function `regulator_get_bypass_regmap':
/drivers/regulator/core.c:2989: undefined reference to `regmap_read'
drivers/built-in.o: In function `regulator_get_voltage_sel_regmap':
/drivers/regulator/core.c:2199: undefined reference to `regmap_read'
drivers/built-in.o: In function `regulator_is_enabled_regmap':
/drivers/regulator/core.c:1916: undefined reference to `regmap_read'
drivers/built-in.o: In function `regulator_set_bypass_regmap':
/drivers/regulator/core.c:2973: undefined reference to `regmap_update_bits'
drivers/built-in.o: In function `regulator_set_voltage_sel_regmap':
/drivers/regulator/core.c:2226: undefined reference to `regmap_update_bits'
/drivers/regulator/core.c:2232: undefined reference to `regmap_update_bits'
drivers/built-in.o: In function `regulator_disable_regmap':
/drivers/regulator/core.c:1968: undefined reference to `regmap_update_bits'
drivers/built-in.o: In function `regulator_enable_regmap':
/drivers/regulator/core.c:1945: undefined reference to `regmap_update_bits'
drivers/built-in.o: In function `regulator_register':
/drivers/regulator/core.c:3581: undefined reference to `dev_get_regmap'
/drivers/regulator/core.c:3582: undefined reference to `dev_get_regmap'
/drivers/regulator/core.c:3584: undefined reference to `dev_get_regmap'
make[4]: *** [vmlinux] Error 1


The following patch would be a solution, but it causes a recursive
dependency:

--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1,5 +1,6 @@
menuconfig REGULATOR
bool "Voltage and Current Regulator Support"
+ depends on REGMAP || REGMAP = n
help
Generic Voltage and Current Regulator support.


drivers/regulator/Kconfig:1:error: recursive dependency detected!
drivers/regulator/Kconfig:1: symbol REGULATOR depends on REGMAP
drivers/base/regmap/Kconfig:5: symbol REGMAP is selected by REGMAP_I2C
drivers/base/regmap/Kconfig:11: symbol REGMAP_I2C is selected by
REGULATOR_FAN53555
drivers/regulator/Kconfig:124: symbol REGULATOR_FAN53555 depends on
REGULATOR

I am not familiar with the regmap and the regulator framework, but I
would suggest to make REGULATOR depend on REGMAP.

Hauke
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/