aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-08-18 20:43:56 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-16 12:24:47 -0400
commit8a1ce2c0447b1a0816f66fde2f832c31b5fbee2c (patch)
treef443998c3dcc9c8c9741fcfc92b9719cd1fef748
parent352e2b961c885b98065c402e2ad85057d0a334b2 (diff)
usb gadget: link fixes for cdc composite gadget
Change how the CDC Composite gadget driver builds: don't use separate compilation, since it works poorly when key parts are library code (with init sections etc). Instead be as close as we can to "gcc --combine ...". Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/gadget/Makefile3
-rw-r--r--drivers/usb/gadget/cdc2.c25
-rw-r--r--drivers/usb/gadget/u_ether.c4
3 files changed, 26 insertions, 6 deletions
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 736d58fe941e..bfa02296a16e 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -31,8 +31,7 @@ g_midi-objs := gmidi.o
31gadgetfs-objs := inode.o 31gadgetfs-objs := inode.o
32g_file_storage-objs := file_storage.o 32g_file_storage-objs := file_storage.o
33g_printer-objs := printer.o 33g_printer-objs := printer.o
34g_cdc-objs := cdc2.o u_ether.o f_ecm.o \ 34g_cdc-objs := cdc2.o
35 u_serial.o f_acm.o $(C_UTILS)
36 35
37ifeq ($(CONFIG_USB_ETH_RNDIS),y) 36ifeq ($(CONFIG_USB_ETH_RNDIS),y)
38 g_ether-objs += f_rndis.o rndis.o 37 g_ether-objs += f_rndis.o rndis.o
diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c
index a39a4b940c33..a724fc149850 100644
--- a/drivers/usb/gadget/cdc2.c
+++ b/drivers/usb/gadget/cdc2.c
@@ -43,6 +43,25 @@
43 43
44/*-------------------------------------------------------------------------*/ 44/*-------------------------------------------------------------------------*/
45 45
46/*
47 * Kbuild is not very cooperative with respect to linking separately
48 * compiled library objects into one module. So for now we won't use
49 * separate compilation ... ensuring init/exit sections work to shrink
50 * the runtime footprint, and giving us at least some parts of what
51 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
52 */
53
54#include "composite.c"
55#include "usbstring.c"
56#include "config.c"
57#include "epautoconf.c"
58#include "u_serial.c"
59#include "f_acm.c"
60#include "f_ecm.c"
61#include "u_ether.c"
62
63/*-------------------------------------------------------------------------*/
64
46static struct usb_device_descriptor device_desc = { 65static struct usb_device_descriptor device_desc = {
47 .bLength = sizeof device_desc, 66 .bLength = sizeof device_desc,
48 .bDescriptorType = USB_DT_DEVICE, 67 .bDescriptorType = USB_DT_DEVICE,
@@ -148,7 +167,8 @@ static int __init cdc_bind(struct usb_composite_dev *cdev)
148 int status; 167 int status;
149 168
150 if (!can_support_ecm(cdev->gadget)) { 169 if (!can_support_ecm(cdev->gadget)) {
151 ERROR(cdev, "controller '%s' not usable\n", gadget->name); 170 dev_err(&gadget->dev, "controller '%s' not usable\n",
171 gadget->name);
152 return -EINVAL; 172 return -EINVAL;
153 } 173 }
154 174
@@ -203,7 +223,8 @@ static int __init cdc_bind(struct usb_composite_dev *cdev)
203 if (status < 0) 223 if (status < 0)
204 goto fail1; 224 goto fail1;
205 225
206 INFO(cdev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC); 226 dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n",
227 DRIVER_DESC);
207 228
208 return 0; 229 return 0;
209 230
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 3791e6271903..dbd575a194f3 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -52,7 +52,7 @@
52 * this single "physical" link to be used by multiple virtual links.) 52 * this single "physical" link to be used by multiple virtual links.)
53 */ 53 */
54 54
55#define DRIVER_VERSION "29-May-2008" 55#define UETH__VERSION "29-May-2008"
56 56
57struct eth_dev { 57struct eth_dev {
58 /* lock is held while accessing port_usb 58 /* lock is held while accessing port_usb
@@ -170,7 +170,7 @@ static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p)
170 struct eth_dev *dev = netdev_priv(net); 170 struct eth_dev *dev = netdev_priv(net);
171 171
172 strlcpy(p->driver, "g_ether", sizeof p->driver); 172 strlcpy(p->driver, "g_ether", sizeof p->driver);
173 strlcpy(p->version, DRIVER_VERSION, sizeof p->version); 173 strlcpy(p->version, UETH__VERSION, sizeof p->version);
174 strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version); 174 strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version);
175 strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info); 175 strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info);
176} 176}