diff mbox

[OpenWrt-Devel,v2] kernel: Fix USB gadget modules for v3.18

Message ID 1424385717-7915-1-git-send-email-osk@exegin.com
State Changes Requested
Headers show

Commit Message

Owen Kirby Feb. 19, 2015, 10:41 p.m. UTC
An update for for the previous patch that should also retain
compatibility with kernel version 3.14 and earlier. This has
been tested to build working packages for the at91 target at
versions 3.14 and 3.18. It also compiles successfully for
version 3.13 on the omap target, but I can't test that it works
without hardware. The USB gadget drivers have gone through the
following changes:

3.8 and earlier:
	g_ether and g_serial were monolithic drivers.

3.10:
	g_ether is a monolithic driver.
	g_serial is split into gadget + function drivers.

3.13 and 3.14:
	g_serial is split into gadget + function drivers.
	g_ether is split into gadget + function drivers.
	u_rndis.ko only existed for version 3.13

3.18 and 3.19:
	g_serial and g_ether are split into gadget + function drivers.
	gadgets and functions are moved into separate subdirectories.

Signed-off-by: Owen Kirby <osk@exegin.com>
---
 package/kernel/linux/modules/usb.mk | 42 ++++++++++++++++++++++---------------
 target/linux/generic/config-3.18    |  1 +
 2 files changed, 26 insertions(+), 17 deletions(-)

Comments

Daniel Golle Feb. 20, 2015, 1:48 a.m. UTC | #1
Hi!

that looks much better already. Thanks for taking care of that.
(though many were aware of the problem, none were willing to fix
it for now, including myself)

On Thu, Feb 19, 2015 at 02:41:57PM -0800, Owen Kirby wrote:
> ...
> +ifeq ($(CONFIG_LINUX_3_8)$(CONFIG_LINUX_3_10),)

Note that there are (unfortunately) still targets stuck on 3.3.
I doubt that this is relevant, but as that whole legacy section
can most likely be removed in the near future, I reckon it doesn't
hurt to add it for now.
Probably it makes more sense to simply add a dependency
DEPENDS:=@!LINUX_3_3 @!LINUX_3_8 @!LINUX_3_10
for all usb-gadget packages instead of creating an empty package
for these kernels (unless this is intended e.g. in case of the
driver having to be built-in or something like that)

> -  FILES:=$(LINUX_DIR)/drivers/usb/gadget/g_ether.ko
> +  FILES:= $(LINUX_DIR)/drivers/usb/gadget/g_ether.ko

No need to add a space here.

> ...
> +ifeq ($(CONFIG_LINUX_3_8),)

Maybe include 3.3 here as well... (or add a dependency instead).

> ...
>  else
> -  FILES:=$(LINUX_DIR)/drivers/usb/gadget/g_serial.ko
> +  FILES:= $(LINUX_DIR)/drivers/usb/gadget/g_serial.ko

Another unneeded space.



Cheers


Daniel
Owen Kirby Feb. 21, 2015, 1:26 a.m. UTC | #2
On 15-02-19 05:48 PM, Daniel Golle wrote:
> On Thu, Feb 19, 2015 at 02:41:57PM -0800, Owen Kirby wrote:
>> ...
>> +ifeq ($(CONFIG_LINUX_3_8)$(CONFIG_LINUX_3_10),)
> Note that there are (unfortunately) still targets stuck on 3.3.
> I doubt that this is relevant, but as that whole legacy section
> can most likely be removed in the near future, I reckon it doesn't
> hurt to add it for now.
> Probably it makes more sense to simply add a dependency
> DEPENDS:=@!LINUX_3_3 @!LINUX_3_8 @!LINUX_3_10
> for all usb-gadget packages instead of creating an empty package
> for these kernels (unless this is intended e.g. in case of the
> driver having to be built-in or something like that)
 From what I could see, the only target with the usbgadget feature enabled,
and on the 3.3 kernel is the omap24xx target, but it's also marked as broken
and it doesn't build for me.

The ifeq condition in the Makefile is just separating between the kernel
versions where the USB gadget drivers were monolithic and when they were
split into separate gadget and function modules. Even for versions 3.8 
and 3.10,
this should still build working packages, just that they only contain 
the g_ether.ko
or g_serial.ko modules (because that's all that should be needed).

I will follow up shortly with a third patch that fixes the whitespace 
and supports
any targets still stuck on 3.3.

Cheers,
Owen
diff mbox

Patch

diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk
index 6faa437..4d89374 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -254,19 +254,22 @@  define KernelPackage/usb-eth-gadget
 	CONFIG_USB_ETH_RNDIS=y \
 	CONFIG_USB_ETH_EEM=n
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite
-ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/gadget/u_ether.ko),)
+ifeq ($(CONFIG_LINUX_3_8)$(CONFIG_LINUX_3_10),)
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/gadget/u_ether.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/usb_f_ecm.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/usb_f_ecm_subset.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/usb_f_rndis.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/g_ether.ko
-  ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/gadget/u_rndis.ko),)
-    FILES+=$(LINUX_DIR)/drivers/usb/gadget/u_rndis.ko
-  endif
+	$(LINUX_DIR)/drivers/usb/gadget/function/u_ether.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_ecm.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_ecm_subset.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_rndis.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/legacy/g_ether.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/u_ether.ko@lt3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/u_rndis.ko@lt3.14 \
+	$(LINUX_DIR)/drivers/usb/gadget/usb_f_ecm.ko@lt3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/usb_f_ecm_subset.ko@lt3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/usb_f_rndis.ko@lt3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/g_ether.ko@lt3.18
   AUTOLOAD:=$(call AutoLoad,52,usb_f_ecm g_ether)
 else
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/g_ether.ko
+  FILES:= $(LINUX_DIR)/drivers/usb/gadget/g_ether.ko
   AUTOLOAD:=$(call AutoLoad,52,g_ether)
 endif
   $(call AddDepends/usb)
@@ -283,16 +286,21 @@  define KernelPackage/usb-serial-gadget
   TITLE:=USB Serial Gadget support
   KCONFIG:=CONFIG_USB_G_SERIAL
   DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite
-ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/gadget/u_serial.ko),)
+ifeq ($(CONFIG_LINUX_3_8),)
   FILES:= \
-	$(LINUX_DIR)/drivers/usb/gadget/u_serial.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/usb_f_acm.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/usb_f_obex.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/usb_f_serial.ko \
-	$(LINUX_DIR)/drivers/usb/gadget/g_serial.ko
+	$(LINUX_DIR)/drivers/usb/gadget/function/u_serial.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_acm.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_obex.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_serial.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/legacy/g_serial.ko@ge3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/u_serial.ko@lt3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/usb_f_acm.ko@lt3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/usb_f_obex.ko@lt3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/usb_f_serial.ko@lt3.18 \
+	$(LINUX_DIR)/drivers/usb/gadget/g_serial.ko@lt3.18
   AUTOLOAD:=$(call AutoLoad,52,usb_f_acm g_serial)
 else
-  FILES:=$(LINUX_DIR)/drivers/usb/gadget/g_serial.ko
+  FILES:= $(LINUX_DIR)/drivers/usb/gadget/g_serial.ko
   AUTOLOAD:=$(call AutoLoad,52,g_serial)
 endif
   $(call AddDepends/usb)
diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18
index e8ae342..7ad0efc 100644
--- a/target/linux/generic/config-3.18
+++ b/target/linux/generic/config-3.18
@@ -4055,6 +4055,7 @@  CONFIG_USB_EZUSB=y
 # CONFIG_USB_GADGET_DEBUG_FS is not set
 CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
 CONFIG_USB_GADGET_VBUS_DRAW=2
+# CONFIG_USB_GADGET_XILINX is not set
 # CONFIG_USB_GL860 is not set
 # CONFIG_USB_GOKU is not set
 # CONFIG_USB_GPIO_VBUS is not set