aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_loopback.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-08-18 20:41:31 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-16 12:24:46 -0400
commit7e75bc0f9006e995a0fa25f0a285addc3d5fd5cb (patch)
treefdd7210c5c7277129a12cad58695903287f36482 /drivers/usb/gadget/f_loopback.c
parent4e9ba518ec19c6c961bf6074ec05ae1a927230bc (diff)
usb gadget: link fixes for gadget zero
Change how the Gadget Zero 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>
Diffstat (limited to 'drivers/usb/gadget/f_loopback.c')
-rw-r--r--drivers/usb/gadget/f_loopback.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c
index eda4cde72c82..87dde012dacc 100644
--- a/drivers/usb/gadget/f_loopback.c
+++ b/drivers/usb/gadget/f_loopback.c
@@ -70,7 +70,7 @@ static struct usb_interface_descriptor loopback_intf = {
70 70
71/* full speed support: */ 71/* full speed support: */
72 72
73static struct usb_endpoint_descriptor fs_source_desc = { 73static struct usb_endpoint_descriptor fs_loop_source_desc = {
74 .bLength = USB_DT_ENDPOINT_SIZE, 74 .bLength = USB_DT_ENDPOINT_SIZE,
75 .bDescriptorType = USB_DT_ENDPOINT, 75 .bDescriptorType = USB_DT_ENDPOINT,
76 76
@@ -78,7 +78,7 @@ static struct usb_endpoint_descriptor fs_source_desc = {
78 .bmAttributes = USB_ENDPOINT_XFER_BULK, 78 .bmAttributes = USB_ENDPOINT_XFER_BULK,
79}; 79};
80 80
81static struct usb_endpoint_descriptor fs_sink_desc = { 81static struct usb_endpoint_descriptor fs_loop_sink_desc = {
82 .bLength = USB_DT_ENDPOINT_SIZE, 82 .bLength = USB_DT_ENDPOINT_SIZE,
83 .bDescriptorType = USB_DT_ENDPOINT, 83 .bDescriptorType = USB_DT_ENDPOINT,
84 84
@@ -88,14 +88,14 @@ static struct usb_endpoint_descriptor fs_sink_desc = {
88 88
89static struct usb_descriptor_header *fs_loopback_descs[] = { 89static struct usb_descriptor_header *fs_loopback_descs[] = {
90 (struct usb_descriptor_header *) &loopback_intf, 90 (struct usb_descriptor_header *) &loopback_intf,
91 (struct usb_descriptor_header *) &fs_sink_desc, 91 (struct usb_descriptor_header *) &fs_loop_sink_desc,
92 (struct usb_descriptor_header *) &fs_source_desc, 92 (struct usb_descriptor_header *) &fs_loop_source_desc,
93 NULL, 93 NULL,
94}; 94};
95 95
96/* high speed support: */ 96/* high speed support: */
97 97
98static struct usb_endpoint_descriptor hs_source_desc = { 98static struct usb_endpoint_descriptor hs_loop_source_desc = {
99 .bLength = USB_DT_ENDPOINT_SIZE, 99 .bLength = USB_DT_ENDPOINT_SIZE,
100 .bDescriptorType = USB_DT_ENDPOINT, 100 .bDescriptorType = USB_DT_ENDPOINT,
101 101
@@ -103,7 +103,7 @@ static struct usb_endpoint_descriptor hs_source_desc = {
103 .wMaxPacketSize = __constant_cpu_to_le16(512), 103 .wMaxPacketSize = __constant_cpu_to_le16(512),
104}; 104};
105 105
106static struct usb_endpoint_descriptor hs_sink_desc = { 106static struct usb_endpoint_descriptor hs_loop_sink_desc = {
107 .bLength = USB_DT_ENDPOINT_SIZE, 107 .bLength = USB_DT_ENDPOINT_SIZE,
108 .bDescriptorType = USB_DT_ENDPOINT, 108 .bDescriptorType = USB_DT_ENDPOINT,
109 109
@@ -113,8 +113,8 @@ static struct usb_endpoint_descriptor hs_sink_desc = {
113 113
114static struct usb_descriptor_header *hs_loopback_descs[] = { 114static struct usb_descriptor_header *hs_loopback_descs[] = {
115 (struct usb_descriptor_header *) &loopback_intf, 115 (struct usb_descriptor_header *) &loopback_intf,
116 (struct usb_descriptor_header *) &hs_source_desc, 116 (struct usb_descriptor_header *) &hs_loop_source_desc,
117 (struct usb_descriptor_header *) &hs_sink_desc, 117 (struct usb_descriptor_header *) &hs_loop_sink_desc,
118 NULL, 118 NULL,
119}; 119};
120 120
@@ -152,7 +152,7 @@ loopback_bind(struct usb_configuration *c, struct usb_function *f)
152 152
153 /* allocate endpoints */ 153 /* allocate endpoints */
154 154
155 loop->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_source_desc); 155 loop->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_loop_source_desc);
156 if (!loop->in_ep) { 156 if (!loop->in_ep) {
157autoconf_fail: 157autoconf_fail:
158 ERROR(cdev, "%s: can't autoconfigure on %s\n", 158 ERROR(cdev, "%s: can't autoconfigure on %s\n",
@@ -161,17 +161,17 @@ autoconf_fail:
161 } 161 }
162 loop->in_ep->driver_data = cdev; /* claim */ 162 loop->in_ep->driver_data = cdev; /* claim */
163 163
164 loop->out_ep = usb_ep_autoconfig(cdev->gadget, &fs_sink_desc); 164 loop->out_ep = usb_ep_autoconfig(cdev->gadget, &fs_loop_sink_desc);
165 if (!loop->out_ep) 165 if (!loop->out_ep)
166 goto autoconf_fail; 166 goto autoconf_fail;
167 loop->out_ep->driver_data = cdev; /* claim */ 167 loop->out_ep->driver_data = cdev; /* claim */
168 168
169 /* support high speed hardware */ 169 /* support high speed hardware */
170 if (gadget_is_dualspeed(c->cdev->gadget)) { 170 if (gadget_is_dualspeed(c->cdev->gadget)) {
171 hs_source_desc.bEndpointAddress = 171 hs_loop_source_desc.bEndpointAddress =
172 fs_source_desc.bEndpointAddress; 172 fs_loop_source_desc.bEndpointAddress;
173 hs_sink_desc.bEndpointAddress = 173 hs_loop_sink_desc.bEndpointAddress =
174 fs_sink_desc.bEndpointAddress; 174 fs_loop_sink_desc.bEndpointAddress;
175 f->hs_descriptors = hs_loopback_descs; 175 f->hs_descriptors = hs_loopback_descs;
176 } 176 }
177 177
@@ -255,8 +255,10 @@ enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop)
255 struct usb_request *req; 255 struct usb_request *req;
256 unsigned i; 256 unsigned i;
257 257
258 src = ep_choose(cdev->gadget, &hs_source_desc, &fs_source_desc); 258 src = ep_choose(cdev->gadget,
259 sink = ep_choose(cdev->gadget, &hs_sink_desc, &fs_sink_desc); 259 &hs_loop_source_desc, &fs_loop_source_desc);
260 sink = ep_choose(cdev->gadget,
261 &hs_loop_sink_desc, &fs_loop_sink_desc);
260 262
261 /* one endpoint writes data back IN to the host */ 263 /* one endpoint writes data back IN to the host */
262 ep = loop->in_ep; 264 ep = loop->in_ep;