[OpenWrt-Devel] [PATCH] kernel: modules: fix kmod-regmap redux

Christian Lamparter chunkeey at gmail.com
Fri Aug 3 17:49:22 EDT 2018


Jonas Gorski commented on the previous patch:
|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
|
|/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
|[...]
|[The regulator code] optionally supports regmap thanks to the stubs
|provided if regmap is disabled - which breaks if you compile regmap
|as a module.

In order to mitigate this issue, this patch reverts the previous patch
and replaces the existing IS_ENABLED(CONFIG_REGMAP) with
IS_REACHABLE(CONFIG_REGMAP). This solves this particular issue as the
regulator code will now automatically fallback to the regmap stubs in
case the kmod-regmap module is enabled, but nothing else sets
CONFIG_REGMAP=y.

Note: There's still a potential issue that this patch doesn't solve:
If someone ever wants to make a OpenWrt kernel package for a
regulator module that requires the REGMAP feature for a target that
doesn't set CONFIG_REGMAP=y but has CONFIG_REGULATOR=y, the resulting
kmod-regulator-xyz package will not work on the target.
Luckily, there aren't any in-tree OpenWrt kernel module packages for
regulators at the moment. On the bright side: regmap is a critical
part nowadays and all new and upcoming architectures require it by
default. This will likely only ever be a problem for legacy targets
and devices that cannot afford to enable REGMAP.

Cc: Jonas Gorski <jonas.gorski at gmail.com>
Cc: John Crispin <john at phrozen.org>
Fixes: d00913d1215b ("kernel: modules: fix kmod-regmap")
Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---

yeee, as usual: nothing is ever complete or simple...
If anyone does have a good idea how to fully tackle the
"final" issue above: Then let's hear it! In the mean time:
Let's try this as an better interim build fix.
---
 package/kernel/linux/modules/other.mk                   | 2 +-
 target/linux/generic/hack-4.14/259-regmap_dynamic.patch | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk
index dd037cf86c..7e18a21db3 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -718,7 +718,7 @@ define KernelPackage/regmap
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Generic register map support
   DEPENDS:=+kmod-lib-lzo +kmod-i2c-core
-  KCONFIG:=CONFIG_REGMAP=y \
+  KCONFIG:=CONFIG_REGMAP \
 	   CONFIG_REGMAP_MMIO \
 	   CONFIG_REGMAP_SPI \
 	   CONFIG_REGMAP_I2C \
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..458b7c35a1 100644
--- a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
+++ b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
@@ -103,7 +103,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  })
  
 -#ifdef CONFIG_REGMAP
-+#if IS_ENABLED(CONFIG_REGMAP)
++#if IS_REACHABLE(CONFIG_REGMAP)
  
  enum regmap_endian {
  	/* Unspecified -> 0 -> Backwards compatible default */
-- 
2.18.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list