On 2018-08-23 12:17, John Crispin wrote:
On 23/08/18 11:53, Martin Schiller wrote:
The mcp23s08 drivers was moved from gpio to pinctrl "subsystem" in linux-4.13.

As linux-4.9 is still used for some targets, how to proceed with this mcp23s08 driver? Create a new (second) CONFIG option (kmod-pinctrl-mcp23s08) coexisting to the kmod-gpio-mcp23s08?

Or is it possible to get this handled by the existing CONFIG option and depend on the kernel version?
Any hints are welcome.

...

add an ifdef guarded sections that check the kernel version inside the
module mk files ?
    John

So I tried this, but "CompareKernelPatchVer" seems not working here:

diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk
index c4cf74d98b..3befc9cba8 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -224,6 +224,23 @@ endef
 $(eval $(call KernelPackage,gpio-dev))


+ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,4.13.0)),1)
+define KernelPackage/pinctrl-mcp23s08
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=Microchip MCP23xxx I/O expander
+  DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core
+  KCONFIG:=CONFIG_PINCTRL_MCP23S08
+  FILES:=$(LINUX_DIR)/drivers/pinctrl/pinctrl-mcp23s08.ko
+  AUTOLOAD:=$(call AutoLoad,40,pinctrl-mcp23s08)
+endef
+
+define KernelPackage/pinctrl-mcp23s08/description
+ Kernel module for Microchip MCP23xxx SPI/I2C I/O expander
+endef
+
+$(eval $(call KernelPackage,pinctrl-mcp23s08))
+
+else
 define KernelPackage/gpio-mcp23s08
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Microchip MCP23xxx I/O expander
@@ -238,7 +255,7 @@ define KernelPackage/gpio-mcp23s08/description
 endef

 $(eval $(call KernelPackage,gpio-mcp23s08))
-
+endif

 define KernelPackage/gpio-nxp-74hc164
   SUBMENU:=$(OTHER_MENU)


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to