aboutsummaryrefslogtreecommitdiffstats
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2008-08-18 16:28:06 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2008-08-18 16:28:06 -0700
commitdc50cc7939ff8e60cc28eaff6370a947f2d36906 (patch)
tree1057d0223443c68f5c022431c7fa7e635b6ad3dd
parent9b7a6012897c8eff3a206a5c3c974ad4e1989fe2 (diff)
downloadpatches-dc50cc7939ff8e60cc28eaff6370a947f2d36906.tar.gz
redo the gadget build issues
-rw-r--r--driver-core/usb-gadget-move-library-files-into-g_cdc.ko.patch88
-rw-r--r--driver-core/usb-gadget-move-library-files-into-g_ether.ko.patch139
-rw-r--r--driver-core/usb-gadget-move-library-files-into-g_file_storage.ko.patch48
-rw-r--r--driver-core/usb-gadget-move-library-files-into-g_midi.ko.patch48
-rw-r--r--driver-core/usb-gadget-move-library-files-into-g_printer.ko.patch49
-rw-r--r--driver-core/usb-gadget-move-library-files-into-g_serial-ko.patch71
-rw-r--r--driver-core/usb-gadget-move-library-files-into-g_zero.ko.patch86
-rw-r--r--series17
8 files changed, 541 insertions, 5 deletions
diff --git a/driver-core/usb-gadget-move-library-files-into-g_cdc.ko.patch b/driver-core/usb-gadget-move-library-files-into-g_cdc.ko.patch
new file mode 100644
index 00000000000000..ac0a2def91abb3
--- /dev/null
+++ b/driver-core/usb-gadget-move-library-files-into-g_cdc.ko.patch
@@ -0,0 +1,88 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Mon, 18 Aug 2008 16:17:23 -0700
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: USB: gadget: move library files into g_cdc.ko
+
+This resolves the issues of trying to build a library file with the
+current Kbuild infrastructure.
+
+Cc: David Brownell <david-b@pacbell.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/Makefile | 5 +----
+ drivers/usb/gadget/cdc2.c | 24 +++++++++++++++++++++---
+ 2 files changed, 22 insertions(+), 7 deletions(-)
+
+--- a/drivers/usb/gadget/cdc2.c
++++ b/drivers/usb/gadget/cdc2.c
+@@ -25,10 +25,26 @@
+ #include "u_ether.h"
+ #include "u_serial.h"
+
+-
+ #define DRIVER_DESC "CDC Composite Gadget"
+ #define DRIVER_VERSION "King Kamehameha Day 2008"
+
++/*
++ * Kbuild is not very cooperative with respect to linking separately
++ * compiled library objects into one module. So for now we won't use
++ * separate compilation ... ensuring init/exit sections work to shrink
++ * the runtime footprint, and giving us at least some parts of what
++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
++ */
++#include "composite.c"
++#include "usbstring.c"
++#include "config.c"
++#include "epautoconf.c"
++
++#include "f_ecm.c"
++#include "f_acm.c"
++#include "u_serial.c"
++#include "u_ether.c"
++
+ /*-------------------------------------------------------------------------*/
+
+ /* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
+@@ -148,7 +164,8 @@ static int __init cdc_bind(struct usb_co
+ int status;
+
+ if (!can_support_ecm(cdev->gadget)) {
+- ERROR(cdev, "controller '%s' not usable\n", gadget->name);
++ dev_err(&cdev->gadget->dev, "controller '%s' not usable\n",
++ gadget->name);
+ return -EINVAL;
+ }
+
+@@ -203,7 +220,8 @@ static int __init cdc_bind(struct usb_co
+ if (status < 0)
+ goto fail1;
+
+- INFO(cdev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC);
++ dev_info(&cdev->gadget->dev, "%s, version: " DRIVER_VERSION "\n",
++ DRIVER_DESC);
+
+ return 0;
+
+--- a/drivers/usb/gadget/Makefile
++++ b/drivers/usb/gadget/Makefile
+@@ -22,8 +22,6 @@ obj-$(CONFIG_USB_M66592) += m66592-udc.o
+ #
+ # USB gadget drivers
+ #
+-C_UTILS = composite.o usbstring.o config.o epautoconf.o
+-
+ g_zero-objs := zero.o
+ g_ether-objs := ether.o
+ g_serial-objs := serial.o
+@@ -31,8 +29,7 @@ g_midi-objs := gmidi.o
+ gadgetfs-objs := inode.o
+ g_file_storage-objs := file_storage.o
+ g_printer-objs := printer.o
+-g_cdc-objs := cdc2.o u_ether.o f_ecm.o \
+- u_serial.o f_acm.o $(C_UTILS)
++g_cdc-objs := cdc2.o
+
+ ifeq ($(CONFIG_USB_ETH_RNDIS),y)
+ g_ether-objs += f_rndis.o rndis.o
diff --git a/driver-core/usb-gadget-move-library-files-into-g_ether.ko.patch b/driver-core/usb-gadget-move-library-files-into-g_ether.ko.patch
new file mode 100644
index 00000000000000..1a37950cbca5c2
--- /dev/null
+++ b/driver-core/usb-gadget-move-library-files-into-g_ether.ko.patch
@@ -0,0 +1,139 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Mon, 18 Aug 2008 16:17:23 -0700
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: USB: gadget: move library files into g_ether.ko
+
+This resolves the issues of trying to build a library file with the
+current Kbuild infrastructure.
+
+Cc: David Brownell <david-b@pacbell.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/Makefile | 2 +-
+ drivers/usb/gadget/ether.c | 20 +++++++++++++++++++-
+ drivers/usb/gadget/f_subset.c | 8 ++++++++
+ drivers/usb/gadget/u_ether.c | 2 --
+ 4 files changed, 28 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/gadget/ether.c
++++ b/drivers/usb/gadget/ether.c
+@@ -73,6 +73,23 @@
+ #endif
+
+ /*
++ * Kbuild is not very cooperative with respect to linking separately
++ * compiled library objects into one module. So for now we won't use
++ * separate compilation ... ensuring init/exit sections work to shrink
++ * the runtime footprint, and giving us at least some parts of what
++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
++ */
++#include "composite.c"
++#include "usbstring.c"
++#include "config.c"
++#include "epautoconf.c"
++
++#include "f_ecm.c"
++#include "f_subset.c"
++#include "u_ether.c"
++
++/*-------------------------------------------------------------------------*/
++/*
+ * This driver aims for interoperability by using CDC ECM unless
+ *
+ * can_support_ecm()
+@@ -332,7 +349,8 @@ static int __init eth_bind(struct usb_co
+ if (status < 0)
+ goto fail;
+
+- INFO(cdev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC);
++ dev_info(&cdev->gadget->dev, "%s, version: " DRIVER_VERSION "\n",
++ DRIVER_DESC);
+
+ return 0;
+
+--- a/drivers/usb/gadget/f_subset.c
++++ b/drivers/usb/gadget/f_subset.c
+@@ -103,6 +103,7 @@ static struct usb_interface_descriptor s
+ /* .iInterface = DYNAMIC */
+ };
+
++#if 0
+ static struct usb_cdc_header_desc header_desc __initdata = {
+ .bLength = sizeof header_desc,
+ .bDescriptorType = USB_DT_CS_INTERFACE,
+@@ -110,6 +111,7 @@ static struct usb_cdc_header_desc header
+
+ .bcdCDC = __constant_cpu_to_le16(0x0110),
+ };
++#endif
+
+ static struct usb_cdc_mdlm_desc mdlm_desc __initdata = {
+ .bLength = sizeof mdlm_desc,
+@@ -137,6 +139,7 @@ static u8 mdlm_detail_desc[] __initdata
+ 0, /* network data capabilities ("raw" encapsulation) */
+ };
+
++#if 0
+ static struct usb_cdc_ether_desc ether_desc __initdata = {
+ .bLength = sizeof ether_desc,
+ .bDescriptorType = USB_DT_CS_INTERFACE,
+@@ -149,9 +152,11 @@ static struct usb_cdc_ether_desc ether_d
+ .wNumberMCFilters = __constant_cpu_to_le16(0),
+ .bNumberPowerFilters = 0,
+ };
++#endif
+
+ /* full speed support: */
+
++#if 0
+ static struct usb_endpoint_descriptor fs_in_desc __initdata = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+@@ -167,6 +172,7 @@ static struct usb_endpoint_descriptor fs
+ .bEndpointAddress = USB_DIR_OUT,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ };
++#endif
+
+ static struct usb_descriptor_header *fs_eth_function[] __initdata = {
+ (struct usb_descriptor_header *) &subset_data_intf,
+@@ -181,6 +187,7 @@ static struct usb_descriptor_header *fs_
+
+ /* high speed support: */
+
++#if 0
+ static struct usb_endpoint_descriptor hs_in_desc __initdata = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+@@ -196,6 +203,7 @@ static struct usb_endpoint_descriptor hs
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = __constant_cpu_to_le16(512),
+ };
++#endif
+
+ static struct usb_descriptor_header *hs_eth_function[] __initdata = {
+ (struct usb_descriptor_header *) &subset_data_intf,
+--- a/drivers/usb/gadget/Makefile
++++ b/drivers/usb/gadget/Makefile
+@@ -25,7 +25,7 @@ obj-$(CONFIG_USB_M66592) += m66592-udc.o
+ C_UTILS = composite.o usbstring.o config.o epautoconf.o
+
+ g_zero-objs := zero.o f_sourcesink.o f_loopback.o $(C_UTILS)
+-g_ether-objs := ether.o u_ether.o f_subset.o f_ecm.o $(C_UTILS)
++g_ether-objs := ether.o
+ g_serial-objs := serial.o
+ g_midi-objs := gmidi.o usbstring.o config.o epautoconf.o
+ gadgetfs-objs := inode.o
+--- a/drivers/usb/gadget/u_ether.c
++++ b/drivers/usb/gadget/u_ether.c
+@@ -52,8 +52,6 @@
+ * this single "physical" link to be used by multiple virtual links.)
+ */
+
+-#define DRIVER_VERSION "29-May-2008"
+-
+ struct eth_dev {
+ /* lock is held while accessing port_usb
+ * or updating its backlink port_usb->ioport
diff --git a/driver-core/usb-gadget-move-library-files-into-g_file_storage.ko.patch b/driver-core/usb-gadget-move-library-files-into-g_file_storage.ko.patch
new file mode 100644
index 00000000000000..0d4374848c779c
--- /dev/null
+++ b/driver-core/usb-gadget-move-library-files-into-g_file_storage.ko.patch
@@ -0,0 +1,48 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Mon, 18 Aug 2008 16:17:23 -0700
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: USB: gadget: move library files into g_file_storage.ko
+
+This resolves the issues of trying to build a library file with the
+current Kbuild infrastructure.
+
+Cc: David Brownell <david-b@pacbell.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/Makefile | 3 +--
+ drivers/usb/gadget/file_storage.c | 10 ++++++++++
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/gadget/file_storage.c
++++ b/drivers/usb/gadget/file_storage.c
+@@ -244,6 +244,16 @@
+
+ #include "gadget_chips.h"
+
++/*
++ * Kbuild is not very cooperative with respect to linking separately
++ * compiled library objects into one module. So for now we won't use
++ * separate compilation ... ensuring init/exit sections work to shrink
++ * the runtime footprint, and giving us at least some parts of what
++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
++ */
++#include "usbstring.c"
++#include "config.c"
++#include "epautoconf.c"
+
+ /*-------------------------------------------------------------------------*/
+
+--- a/drivers/usb/gadget/Makefile
++++ b/drivers/usb/gadget/Makefile
+@@ -29,8 +29,7 @@ g_ether-objs := ether.o
+ g_serial-objs := serial.o
+ g_midi-objs := gmidi.o
+ gadgetfs-objs := inode.o
+-g_file_storage-objs := file_storage.o usbstring.o config.o \
+- epautoconf.o
++g_file_storage-objs := file_storage.o
+ g_printer-objs := printer.o usbstring.o config.o \
+ epautoconf.o
+ g_cdc-objs := cdc2.o u_ether.o f_ecm.o \
diff --git a/driver-core/usb-gadget-move-library-files-into-g_midi.ko.patch b/driver-core/usb-gadget-move-library-files-into-g_midi.ko.patch
new file mode 100644
index 00000000000000..c28fc3f5497476
--- /dev/null
+++ b/driver-core/usb-gadget-move-library-files-into-g_midi.ko.patch
@@ -0,0 +1,48 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Mon, 18 Aug 2008 16:17:23 -0700
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: USB: gadget: move library files into g_midi.ko
+
+This resolves the issues of trying to build a library file with the
+current Kbuild infrastructure.
+
+Cc: David Brownell <david-b@pacbell.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/Makefile | 2 +-
+ drivers/usb/gadget/gmidi.c | 11 +++++++++++
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/gadget/gmidi.c
++++ b/drivers/usb/gadget/gmidi.c
+@@ -35,6 +35,17 @@
+
+ #include "gadget_chips.h"
+
++/*
++ * Kbuild is not very cooperative with respect to linking separately
++ * compiled library objects into one module. So for now we won't use
++ * separate compilation ... ensuring init/exit sections work to shrink
++ * the runtime footprint, and giving us at least some parts of what
++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
++ */
++#include "usbstring.c"
++#include "config.c"
++#include "epautoconf.c"
++
+ MODULE_AUTHOR("Ben Williamson");
+ MODULE_LICENSE("GPL v2");
+
+--- a/drivers/usb/gadget/Makefile
++++ b/drivers/usb/gadget/Makefile
+@@ -27,7 +27,7 @@ C_UTILS = composite.o usbstring.o config
+ g_zero-objs := zero.o
+ g_ether-objs := ether.o
+ g_serial-objs := serial.o
+-g_midi-objs := gmidi.o usbstring.o config.o epautoconf.o
++g_midi-objs := gmidi.o
+ gadgetfs-objs := inode.o
+ g_file_storage-objs := file_storage.o usbstring.o config.o \
+ epautoconf.o
diff --git a/driver-core/usb-gadget-move-library-files-into-g_printer.ko.patch b/driver-core/usb-gadget-move-library-files-into-g_printer.ko.patch
new file mode 100644
index 00000000000000..74d770b775ee2b
--- /dev/null
+++ b/driver-core/usb-gadget-move-library-files-into-g_printer.ko.patch
@@ -0,0 +1,49 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Mon, 18 Aug 2008 16:17:23 -0700
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: USB: gadget: move library files into g_printer.ko
+
+This resolves the issues of trying to build a library file with the
+current Kbuild infrastructure.
+
+Cc: David Brownell <david-b@pacbell.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/Makefile | 3 +--
+ drivers/usb/gadget/printer.c | 11 +++++++++++
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/gadget/Makefile
++++ b/drivers/usb/gadget/Makefile
+@@ -30,8 +30,7 @@ g_serial-objs := serial.o
+ g_midi-objs := gmidi.o
+ gadgetfs-objs := inode.o
+ g_file_storage-objs := file_storage.o
+-g_printer-objs := printer.o usbstring.o config.o \
+- epautoconf.o
++g_printer-objs := printer.o
+ g_cdc-objs := cdc2.o u_ether.o f_ecm.o \
+ u_serial.o f_acm.o $(C_UTILS)
+
+--- a/drivers/usb/gadget/printer.c
++++ b/drivers/usb/gadget/printer.c
+@@ -63,6 +63,17 @@ static dev_t g_printer_devno;
+
+ static struct class *usb_gadget_class;
+
++/*
++ * Kbuild is not very cooperative with respect to linking separately
++ * compiled library objects into one module. So for now we won't use
++ * separate compilation ... ensuring init/exit sections work to shrink
++ * the runtime footprint, and giving us at least some parts of what
++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
++ */
++#include "usbstring.c"
++#include "config.c"
++#include "epautoconf.c"
++
+ /*-------------------------------------------------------------------------*/
+
+ struct printer_dev {
diff --git a/driver-core/usb-gadget-move-library-files-into-g_serial-ko.patch b/driver-core/usb-gadget-move-library-files-into-g_serial-ko.patch
new file mode 100644
index 00000000000000..de80c8cf652f2a
--- /dev/null
+++ b/driver-core/usb-gadget-move-library-files-into-g_serial-ko.patch
@@ -0,0 +1,71 @@
+From david-b@pacbell.net Thu Aug 14 16:47:31 2008
+From: David Brownell <david-b@pacbell.net>
+Date: Thu, 14 Aug 2008 16:47:25 -0700
+Subject: USB: gadget: move library files into g_serial,ko
+To: Greg KH <greg@kroah.com>, linux-usb@vger.kernel.org
+Message-ID: <200808141647.25336.david-b@pacbell.net>
+Content-Disposition: inline
+
+
+This is a quick patch addressing the linkage issues with separately
+compiled gadget module components by eliminating separate compilation
+for one of the gadget drivers.
+
+It even saves some space. On one x86_64 build:
+
+ text data bss dec hex filename
+ 17514 2144 676 20334 4f6e g_serial.ko BEFORE
+ 17513 2119 660 20292 4f44 g_serial.ko AFTER
+ ----- ---- --- -----
+ 1 25 16 42 Difference
+
+If Kbuild someday supports "--combine" we could do this more cleanly,
+and I think that would save even more space.
+
+
+From: David Brownell <david-b@pacbell.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/Makefile | 2 +-
+ drivers/usb/gadget/serial.c | 18 ++++++++++++++++++
+ 2 files changed, 19 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/gadget/Makefile
++++ b/drivers/usb/gadget/Makefile
+@@ -26,7 +26,7 @@ C_UTILS = composite.o usbstring.o config
+
+ g_zero-objs := zero.o f_sourcesink.o f_loopback.o $(C_UTILS)
+ g_ether-objs := ether.o u_ether.o f_subset.o f_ecm.o $(C_UTILS)
+-g_serial-objs := serial.o u_serial.o f_acm.o f_serial.o $(C_UTILS)
++g_serial-objs := serial.o
+ g_midi-objs := gmidi.o usbstring.o config.o epautoconf.o
+ gadgetfs-objs := inode.o
+ g_file_storage-objs := file_storage.o usbstring.o config.o \
+--- a/drivers/usb/gadget/serial.c
++++ b/drivers/usb/gadget/serial.c
+@@ -30,6 +30,24 @@
+
+ /*-------------------------------------------------------------------------*/
+
++/*
++ * Kbuild is not very cooperative with respect to linking separately
++ * compiled library objects into one module. So for now we won't use
++ * separate compilation ... ensuring init/exit sections work to shrink
++ * the runtime footprint, and giving us at least some parts of what
++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
++ */
++#include "composite.c"
++#include "usbstring.c"
++#include "config.c"
++#include "epautoconf.c"
++
++#include "f_acm.c"
++#include "f_serial.c"
++#include "u_serial.c"
++
++/*-------------------------------------------------------------------------*/
++
+ /* Thanks to NetChip Technologies for donating this product ID.
+ *
+ * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
diff --git a/driver-core/usb-gadget-move-library-files-into-g_zero.ko.patch b/driver-core/usb-gadget-move-library-files-into-g_zero.ko.patch
new file mode 100644
index 00000000000000..955adc4ff37242
--- /dev/null
+++ b/driver-core/usb-gadget-move-library-files-into-g_zero.ko.patch
@@ -0,0 +1,86 @@
+From foo@baz Tue Apr 9 12:12:43 2002
+Date: Mon, 18 Aug 2008 16:17:23 -0700
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: USB: gadget: move library files into g_zero.ko
+
+This resolves the issues of trying to build a library file with the
+current Kbuild infrastructure.
+
+Cc: David Brownell <david-b@pacbell.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/Makefile | 2 +-
+ drivers/usb/gadget/f_loopback.c | 4 ++++
+ drivers/usb/gadget/zero.c | 14 ++++++++++++++
+ 3 files changed, 19 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/gadget/f_loopback.c
++++ b/drivers/usb/gadget/f_loopback.c
+@@ -70,6 +70,7 @@ static struct usb_interface_descriptor l
+
+ /* full speed support: */
+
++#if 0
+ static struct usb_endpoint_descriptor fs_source_desc = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+@@ -85,6 +86,7 @@ static struct usb_endpoint_descriptor fs
+ .bEndpointAddress = USB_DIR_OUT,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ };
++#endif
+
+ static struct usb_descriptor_header *fs_loopback_descs[] = {
+ (struct usb_descriptor_header *) &loopback_intf,
+@@ -95,6 +97,7 @@ static struct usb_descriptor_header *fs_
+
+ /* high speed support: */
+
++#if 0
+ static struct usb_endpoint_descriptor hs_source_desc = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+@@ -110,6 +113,7 @@ static struct usb_endpoint_descriptor hs
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = __constant_cpu_to_le16(512),
+ };
++#endif
+
+ static struct usb_descriptor_header *hs_loopback_descs[] = {
+ (struct usb_descriptor_header *) &loopback_intf,
+--- a/drivers/usb/gadget/Makefile
++++ b/drivers/usb/gadget/Makefile
+@@ -24,7 +24,7 @@ obj-$(CONFIG_USB_M66592) += m66592-udc.o
+ #
+ C_UTILS = composite.o usbstring.o config.o epautoconf.o
+
+-g_zero-objs := zero.o f_sourcesink.o f_loopback.o $(C_UTILS)
++g_zero-objs := zero.o
+ g_ether-objs := ether.o
+ g_serial-objs := serial.o
+ g_midi-objs := gmidi.o usbstring.o config.o epautoconf.o
+--- a/drivers/usb/gadget/zero.c
++++ b/drivers/usb/gadget/zero.c
+@@ -56,6 +56,20 @@
+ #include "g_zero.h"
+ #include "gadget_chips.h"
+
++/*
++ * Kbuild is not very cooperative with respect to linking separately
++ * compiled library objects into one module. So for now we won't use
++ * separate compilation ... ensuring init/exit sections work to shrink
++ * the runtime footprint, and giving us at least some parts of what
++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
++ */
++#include "composite.c"
++#include "usbstring.c"
++#include "config.c"
++#include "epautoconf.c"
++
++#include "f_sourcesink.c"
++#include "f_loopback.c"
+
+ /*-------------------------------------------------------------------------*/
+
diff --git a/series b/series
index 296ad8c844ee56..bd624240bbc294 100644
--- a/series
+++ b/series
@@ -54,13 +54,20 @@ driver-core.current/kobject-fix-kobject_rename-and-config_sysfs.patch
#################################
# usb patches are needed to get dynamic debug patch to build properly.
-driver-core/usb-gadget-make-gadget_core.ko.patch
-driver-core/usb-gadget-move-u_ether.c-to-gadget_ether_core.ko.patch
-driver-core/usb-gadget-move-f_ecm.c-to-gadget_ecm_core.ko.patch
-driver-core/usb-gadget-move-f_acm.c-and-u_serial.c-gadget_acm_core.ko.patch
+driver-core/usb-gadget-move-library-files-into-g_serial-ko.patch
+driver-core/usb-gadget-move-library-files-into-g_ether.ko.patch
+driver-core/usb-gadget-move-library-files-into-g_zero.ko.patch
+driver-core/usb-gadget-move-library-files-into-g_midi.ko.patch
+driver-core/usb-gadget-move-library-files-into-g_file_storage.ko.patch
+driver-core/usb-gadget-move-library-files-into-g_printer.ko.patch
+driver-core/usb-gadget-move-library-files-into-g_cdc.ko.patch
+
+#driver-core/usb-gadget-make-gadget_core.ko.patch
+#driver-core/usb-gadget-move-u_ether.c-to-gadget_ether_core.ko.patch
+#driver-core/usb-gadget-move-f_ecm.c-to-gadget_ecm_core.ko.patch
+#driver-core/usb-gadget-move-f_acm.c-and-u_serial.c-gadget_acm_core.ko.patch
driver-core/driver-core-basic-infrastructure-for-per-module-dynamic-debug-messages.patch
-
driver-core/driver-core-make-struct-platform_pm_ops-static.patch
driver-core/sysfs-support-sysfs_notify-from-atomic-context-with-new-sysfs_notify_dirent.patch