aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-08-18 20:45:07 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-16 12:24:47 -0400
commit33376c1c043c05077b4ac79c33804266f6c45e49 (patch)
tree95d28177840c3eb1d650d7351319be2f4e141c5b
parent8a1ce2c0447b1a0816f66fde2f832c31b5fbee2c (diff)
usb gadget: link fixes for network gadget
Change how the Ethernet/RNDIS 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 ...". This is a bit more complicated than most of the others because it had to resolve a few symbol collisions. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/gadget/Makefile8
-rw-r--r--drivers/usb/gadget/ether.c28
-rw-r--r--drivers/usb/gadget/f_ecm.c108
-rw-r--r--drivers/usb/gadget/f_subset.c44
-rw-r--r--drivers/usb/gadget/rndis.c115
5 files changed, 158 insertions, 145 deletions
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index bfa02296a16e..2267fa0b51b2 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -22,10 +22,8 @@ obj-$(CONFIG_USB_M66592) += m66592-udc.o
22# 22#
23# USB gadget drivers 23# USB gadget drivers
24# 24#
25C_UTILS = composite.o usbstring.o config.o epautoconf.o
26
27g_zero-objs := zero.o 25g_zero-objs := zero.o
28g_ether-objs := ether.o u_ether.o f_subset.o f_ecm.o $(C_UTILS) 26g_ether-objs := ether.o
29g_serial-objs := serial.o 27g_serial-objs := serial.o
30g_midi-objs := gmidi.o 28g_midi-objs := gmidi.o
31gadgetfs-objs := inode.o 29gadgetfs-objs := inode.o
@@ -33,10 +31,6 @@ g_file_storage-objs := file_storage.o
33g_printer-objs := printer.o 31g_printer-objs := printer.o
34g_cdc-objs := cdc2.o 32g_cdc-objs := cdc2.o
35 33
36ifeq ($(CONFIG_USB_ETH_RNDIS),y)
37 g_ether-objs += f_rndis.o rndis.o
38endif
39
40obj-$(CONFIG_USB_ZERO) += g_zero.o 34obj-$(CONFIG_USB_ZERO) += g_zero.o
41obj-$(CONFIG_USB_ETH) += g_ether.o 35obj-$(CONFIG_USB_ETH) += g_ether.o
42obj-$(CONFIG_USB_GADGETFS) += gadgetfs.o 36obj-$(CONFIG_USB_GADGETFS) += gadgetfs.o
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index bcac2e68660d..944c8e889ab4 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -96,6 +96,28 @@ static inline bool has_rndis(void)
96 96
97/*-------------------------------------------------------------------------*/ 97/*-------------------------------------------------------------------------*/
98 98
99/*
100 * Kbuild is not very cooperative with respect to linking separately
101 * compiled library objects into one module. So for now we won't use
102 * separate compilation ... ensuring init/exit sections work to shrink
103 * the runtime footprint, and giving us at least some parts of what
104 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
105 */
106#include "composite.c"
107#include "usbstring.c"
108#include "config.c"
109#include "epautoconf.c"
110
111#include "f_ecm.c"
112#include "f_subset.c"
113#ifdef CONFIG_USB_ETH_RNDIS
114#include "f_rndis.c"
115#include "rndis.c"
116#endif
117#include "u_ether.c"
118
119/*-------------------------------------------------------------------------*/
120
99/* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! 121/* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
100 * Instead: allocate your own, using normal USB-IF procedures. 122 * Instead: allocate your own, using normal USB-IF procedures.
101 */ 123 */
@@ -293,7 +315,8 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
293 * but if the controller isn't recognized at all then 315 * but if the controller isn't recognized at all then
294 * that assumption is a bit more likely to be wrong. 316 * that assumption is a bit more likely to be wrong.
295 */ 317 */
296 WARNING(cdev, "controller '%s' not recognized; trying %s\n", 318 dev_warn(&gadget->dev,
319 "controller '%s' not recognized; trying %s\n",
297 gadget->name, 320 gadget->name,
298 eth_config_driver.label); 321 eth_config_driver.label);
299 device_desc.bcdDevice = 322 device_desc.bcdDevice =
@@ -332,7 +355,8 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
332 if (status < 0) 355 if (status < 0)
333 goto fail; 356 goto fail;
334 357
335 INFO(cdev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC); 358 dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n",
359 DRIVER_DESC);
336 360
337 return 0; 361 return 0;
338 362
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c
index a2b5c092bda0..4ae579948e54 100644
--- a/drivers/usb/gadget/f_ecm.c
+++ b/drivers/usb/gadget/f_ecm.c
@@ -83,7 +83,7 @@ static inline struct f_ecm *func_to_ecm(struct usb_function *f)
83} 83}
84 84
85/* peak (theoretical) bulk transfer rate in bits-per-second */ 85/* peak (theoretical) bulk transfer rate in bits-per-second */
86static inline unsigned bitrate(struct usb_gadget *g) 86static inline unsigned ecm_bitrate(struct usb_gadget *g)
87{ 87{
88 if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) 88 if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
89 return 13 * 512 * 8 * 1000 * 8; 89 return 13 * 512 * 8 * 1000 * 8;
@@ -107,7 +107,7 @@ static inline unsigned bitrate(struct usb_gadget *g)
107 */ 107 */
108 108
109#define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */ 109#define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */
110#define STATUS_BYTECOUNT 16 /* 8 byte header + data */ 110#define ECM_STATUS_BYTECOUNT 16 /* 8 byte header + data */
111 111
112 112
113/* interface descriptor: */ 113/* interface descriptor: */
@@ -125,8 +125,8 @@ static struct usb_interface_descriptor ecm_control_intf __initdata = {
125 /* .iInterface = DYNAMIC */ 125 /* .iInterface = DYNAMIC */
126}; 126};
127 127
128static struct usb_cdc_header_desc header_desc __initdata = { 128static struct usb_cdc_header_desc ecm_header_desc __initdata = {
129 .bLength = sizeof header_desc, 129 .bLength = sizeof ecm_header_desc,
130 .bDescriptorType = USB_DT_CS_INTERFACE, 130 .bDescriptorType = USB_DT_CS_INTERFACE,
131 .bDescriptorSubType = USB_CDC_HEADER_TYPE, 131 .bDescriptorSubType = USB_CDC_HEADER_TYPE,
132 132
@@ -141,8 +141,8 @@ static struct usb_cdc_union_desc ecm_union_desc __initdata = {
141 /* .bSlaveInterface0 = DYNAMIC */ 141 /* .bSlaveInterface0 = DYNAMIC */
142}; 142};
143 143
144static struct usb_cdc_ether_desc ether_desc __initdata = { 144static struct usb_cdc_ether_desc ecm_desc __initdata = {
145 .bLength = sizeof ether_desc, 145 .bLength = sizeof ecm_desc,
146 .bDescriptorType = USB_DT_CS_INTERFACE, 146 .bDescriptorType = USB_DT_CS_INTERFACE,
147 .bDescriptorSubType = USB_CDC_ETHERNET_TYPE, 147 .bDescriptorSubType = USB_CDC_ETHERNET_TYPE,
148 148
@@ -186,17 +186,17 @@ static struct usb_interface_descriptor ecm_data_intf __initdata = {
186 186
187/* full speed support: */ 187/* full speed support: */
188 188
189static struct usb_endpoint_descriptor fs_notify_desc __initdata = { 189static struct usb_endpoint_descriptor fs_ecm_notify_desc __initdata = {
190 .bLength = USB_DT_ENDPOINT_SIZE, 190 .bLength = USB_DT_ENDPOINT_SIZE,
191 .bDescriptorType = USB_DT_ENDPOINT, 191 .bDescriptorType = USB_DT_ENDPOINT,
192 192
193 .bEndpointAddress = USB_DIR_IN, 193 .bEndpointAddress = USB_DIR_IN,
194 .bmAttributes = USB_ENDPOINT_XFER_INT, 194 .bmAttributes = USB_ENDPOINT_XFER_INT,
195 .wMaxPacketSize = __constant_cpu_to_le16(STATUS_BYTECOUNT), 195 .wMaxPacketSize = __constant_cpu_to_le16(ECM_STATUS_BYTECOUNT),
196 .bInterval = 1 << LOG2_STATUS_INTERVAL_MSEC, 196 .bInterval = 1 << LOG2_STATUS_INTERVAL_MSEC,
197}; 197};
198 198
199static struct usb_endpoint_descriptor fs_in_desc __initdata = { 199static struct usb_endpoint_descriptor fs_ecm_in_desc __initdata = {
200 .bLength = USB_DT_ENDPOINT_SIZE, 200 .bLength = USB_DT_ENDPOINT_SIZE,
201 .bDescriptorType = USB_DT_ENDPOINT, 201 .bDescriptorType = USB_DT_ENDPOINT,
202 202
@@ -204,7 +204,7 @@ static struct usb_endpoint_descriptor fs_in_desc __initdata = {
204 .bmAttributes = USB_ENDPOINT_XFER_BULK, 204 .bmAttributes = USB_ENDPOINT_XFER_BULK,
205}; 205};
206 206
207static struct usb_endpoint_descriptor fs_out_desc __initdata = { 207static struct usb_endpoint_descriptor fs_ecm_out_desc __initdata = {
208 .bLength = USB_DT_ENDPOINT_SIZE, 208 .bLength = USB_DT_ENDPOINT_SIZE,
209 .bDescriptorType = USB_DT_ENDPOINT, 209 .bDescriptorType = USB_DT_ENDPOINT,
210 210
@@ -212,34 +212,34 @@ static struct usb_endpoint_descriptor fs_out_desc __initdata = {
212 .bmAttributes = USB_ENDPOINT_XFER_BULK, 212 .bmAttributes = USB_ENDPOINT_XFER_BULK,
213}; 213};
214 214
215static struct usb_descriptor_header *eth_fs_function[] __initdata = { 215static struct usb_descriptor_header *ecm_fs_function[] __initdata = {
216 /* CDC ECM control descriptors */ 216 /* CDC ECM control descriptors */
217 (struct usb_descriptor_header *) &ecm_control_intf, 217 (struct usb_descriptor_header *) &ecm_control_intf,
218 (struct usb_descriptor_header *) &header_desc, 218 (struct usb_descriptor_header *) &ecm_header_desc,
219 (struct usb_descriptor_header *) &ecm_union_desc, 219 (struct usb_descriptor_header *) &ecm_union_desc,
220 (struct usb_descriptor_header *) &ether_desc, 220 (struct usb_descriptor_header *) &ecm_desc,
221 /* NOTE: status endpoint might need to be removed */ 221 /* NOTE: status endpoint might need to be removed */
222 (struct usb_descriptor_header *) &fs_notify_desc, 222 (struct usb_descriptor_header *) &fs_ecm_notify_desc,
223 /* data interface, altsettings 0 and 1 */ 223 /* data interface, altsettings 0 and 1 */
224 (struct usb_descriptor_header *) &ecm_data_nop_intf, 224 (struct usb_descriptor_header *) &ecm_data_nop_intf,
225 (struct usb_descriptor_header *) &ecm_data_intf, 225 (struct usb_descriptor_header *) &ecm_data_intf,
226 (struct usb_descriptor_header *) &fs_in_desc, 226 (struct usb_descriptor_header *) &fs_ecm_in_desc,
227 (struct usb_descriptor_header *) &fs_out_desc, 227 (struct usb_descriptor_header *) &fs_ecm_out_desc,
228 NULL, 228 NULL,
229}; 229};
230 230
231/* high speed support: */ 231/* high speed support: */
232 232
233static struct usb_endpoint_descriptor hs_notify_desc __initdata = { 233static struct usb_endpoint_descriptor hs_ecm_notify_desc __initdata = {
234 .bLength = USB_DT_ENDPOINT_SIZE, 234 .bLength = USB_DT_ENDPOINT_SIZE,
235 .bDescriptorType = USB_DT_ENDPOINT, 235 .bDescriptorType = USB_DT_ENDPOINT,
236 236
237 .bEndpointAddress = USB_DIR_IN, 237 .bEndpointAddress = USB_DIR_IN,
238 .bmAttributes = USB_ENDPOINT_XFER_INT, 238 .bmAttributes = USB_ENDPOINT_XFER_INT,
239 .wMaxPacketSize = __constant_cpu_to_le16(STATUS_BYTECOUNT), 239 .wMaxPacketSize = __constant_cpu_to_le16(ECM_STATUS_BYTECOUNT),
240 .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, 240 .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4,
241}; 241};
242static struct usb_endpoint_descriptor hs_in_desc __initdata = { 242static struct usb_endpoint_descriptor hs_ecm_in_desc __initdata = {
243 .bLength = USB_DT_ENDPOINT_SIZE, 243 .bLength = USB_DT_ENDPOINT_SIZE,
244 .bDescriptorType = USB_DT_ENDPOINT, 244 .bDescriptorType = USB_DT_ENDPOINT,
245 245
@@ -248,7 +248,7 @@ static struct usb_endpoint_descriptor hs_in_desc __initdata = {
248 .wMaxPacketSize = __constant_cpu_to_le16(512), 248 .wMaxPacketSize = __constant_cpu_to_le16(512),
249}; 249};
250 250
251static struct usb_endpoint_descriptor hs_out_desc __initdata = { 251static struct usb_endpoint_descriptor hs_ecm_out_desc __initdata = {
252 .bLength = USB_DT_ENDPOINT_SIZE, 252 .bLength = USB_DT_ENDPOINT_SIZE,
253 .bDescriptorType = USB_DT_ENDPOINT, 253 .bDescriptorType = USB_DT_ENDPOINT,
254 254
@@ -257,19 +257,19 @@ static struct usb_endpoint_descriptor hs_out_desc __initdata = {
257 .wMaxPacketSize = __constant_cpu_to_le16(512), 257 .wMaxPacketSize = __constant_cpu_to_le16(512),
258}; 258};
259 259
260static struct usb_descriptor_header *eth_hs_function[] __initdata = { 260static struct usb_descriptor_header *ecm_hs_function[] __initdata = {
261 /* CDC ECM control descriptors */ 261 /* CDC ECM control descriptors */
262 (struct usb_descriptor_header *) &ecm_control_intf, 262 (struct usb_descriptor_header *) &ecm_control_intf,
263 (struct usb_descriptor_header *) &header_desc, 263 (struct usb_descriptor_header *) &ecm_header_desc,
264 (struct usb_descriptor_header *) &ecm_union_desc, 264 (struct usb_descriptor_header *) &ecm_union_desc,
265 (struct usb_descriptor_header *) &ether_desc, 265 (struct usb_descriptor_header *) &ecm_desc,
266 /* NOTE: status endpoint might need to be removed */ 266 /* NOTE: status endpoint might need to be removed */
267 (struct usb_descriptor_header *) &hs_notify_desc, 267 (struct usb_descriptor_header *) &hs_ecm_notify_desc,
268 /* data interface, altsettings 0 and 1 */ 268 /* data interface, altsettings 0 and 1 */
269 (struct usb_descriptor_header *) &ecm_data_nop_intf, 269 (struct usb_descriptor_header *) &ecm_data_nop_intf,
270 (struct usb_descriptor_header *) &ecm_data_intf, 270 (struct usb_descriptor_header *) &ecm_data_intf,
271 (struct usb_descriptor_header *) &hs_in_desc, 271 (struct usb_descriptor_header *) &hs_ecm_in_desc,
272 (struct usb_descriptor_header *) &hs_out_desc, 272 (struct usb_descriptor_header *) &hs_ecm_out_desc,
273 NULL, 273 NULL,
274}; 274};
275 275
@@ -329,14 +329,14 @@ static void ecm_do_notify(struct f_ecm *ecm)
329 event->bNotificationType = USB_CDC_NOTIFY_SPEED_CHANGE; 329 event->bNotificationType = USB_CDC_NOTIFY_SPEED_CHANGE;
330 event->wValue = cpu_to_le16(0); 330 event->wValue = cpu_to_le16(0);
331 event->wLength = cpu_to_le16(8); 331 event->wLength = cpu_to_le16(8);
332 req->length = STATUS_BYTECOUNT; 332 req->length = ECM_STATUS_BYTECOUNT;
333 333
334 /* SPEED_CHANGE data is up/down speeds in bits/sec */ 334 /* SPEED_CHANGE data is up/down speeds in bits/sec */
335 data = req->buf + sizeof *event; 335 data = req->buf + sizeof *event;
336 data[0] = cpu_to_le32(bitrate(cdev->gadget)); 336 data[0] = cpu_to_le32(ecm_bitrate(cdev->gadget));
337 data[1] = data[0]; 337 data[1] = data[0];
338 338
339 DBG(cdev, "notify speed %d\n", bitrate(cdev->gadget)); 339 DBG(cdev, "notify speed %d\n", ecm_bitrate(cdev->gadget));
340 ecm->notify_state = ECM_NOTIFY_NONE; 340 ecm->notify_state = ECM_NOTIFY_NONE;
341 break; 341 break;
342 } 342 }
@@ -628,13 +628,13 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
628 status = -ENODEV; 628 status = -ENODEV;
629 629
630 /* allocate instance-specific endpoints */ 630 /* allocate instance-specific endpoints */
631 ep = usb_ep_autoconfig(cdev->gadget, &fs_in_desc); 631 ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_in_desc);
632 if (!ep) 632 if (!ep)
633 goto fail; 633 goto fail;
634 ecm->port.in_ep = ep; 634 ecm->port.in_ep = ep;
635 ep->driver_data = cdev; /* claim */ 635 ep->driver_data = cdev; /* claim */
636 636
637 ep = usb_ep_autoconfig(cdev->gadget, &fs_out_desc); 637 ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_out_desc);
638 if (!ep) 638 if (!ep)
639 goto fail; 639 goto fail;
640 ecm->port.out_ep = ep; 640 ecm->port.out_ep = ep;
@@ -644,7 +644,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
644 * don't treat it that way. It's simpler, and some newer CDC 644 * don't treat it that way. It's simpler, and some newer CDC
645 * profiles (wireless handsets) no longer treat it as optional. 645 * profiles (wireless handsets) no longer treat it as optional.
646 */ 646 */
647 ep = usb_ep_autoconfig(cdev->gadget, &fs_notify_desc); 647 ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_notify_desc);
648 if (!ep) 648 if (!ep)
649 goto fail; 649 goto fail;
650 ecm->notify = ep; 650 ecm->notify = ep;
@@ -656,47 +656,47 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
656 ecm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL); 656 ecm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL);
657 if (!ecm->notify_req) 657 if (!ecm->notify_req)
658 goto fail; 658 goto fail;
659 ecm->notify_req->buf = kmalloc(STATUS_BYTECOUNT, GFP_KERNEL); 659 ecm->notify_req->buf = kmalloc(ECM_STATUS_BYTECOUNT, GFP_KERNEL);
660 if (!ecm->notify_req->buf) 660 if (!ecm->notify_req->buf)
661 goto fail; 661 goto fail;
662 ecm->notify_req->context = ecm; 662 ecm->notify_req->context = ecm;
663 ecm->notify_req->complete = ecm_notify_complete; 663 ecm->notify_req->complete = ecm_notify_complete;
664 664
665 /* copy descriptors, and track endpoint copies */ 665 /* copy descriptors, and track endpoint copies */
666 f->descriptors = usb_copy_descriptors(eth_fs_function); 666 f->descriptors = usb_copy_descriptors(ecm_fs_function);
667 if (!f->descriptors) 667 if (!f->descriptors)
668 goto fail; 668 goto fail;
669 669
670 ecm->fs.in = usb_find_endpoint(eth_fs_function, 670 ecm->fs.in = usb_find_endpoint(ecm_fs_function,
671 f->descriptors, &fs_in_desc); 671 f->descriptors, &fs_ecm_in_desc);
672 ecm->fs.out = usb_find_endpoint(eth_fs_function, 672 ecm->fs.out = usb_find_endpoint(ecm_fs_function,
673 f->descriptors, &fs_out_desc); 673 f->descriptors, &fs_ecm_out_desc);
674 ecm->fs.notify = usb_find_endpoint(eth_fs_function, 674 ecm->fs.notify = usb_find_endpoint(ecm_fs_function,
675 f->descriptors, &fs_notify_desc); 675 f->descriptors, &fs_ecm_notify_desc);
676 676
677 /* support all relevant hardware speeds... we expect that when 677 /* support all relevant hardware speeds... we expect that when
678 * hardware is dual speed, all bulk-capable endpoints work at 678 * hardware is dual speed, all bulk-capable endpoints work at
679 * both speeds 679 * both speeds
680 */ 680 */
681 if (gadget_is_dualspeed(c->cdev->gadget)) { 681 if (gadget_is_dualspeed(c->cdev->gadget)) {
682 hs_in_desc.bEndpointAddress = 682 hs_ecm_in_desc.bEndpointAddress =
683 fs_in_desc.bEndpointAddress; 683 fs_ecm_in_desc.bEndpointAddress;
684 hs_out_desc.bEndpointAddress = 684 hs_ecm_out_desc.bEndpointAddress =
685 fs_out_desc.bEndpointAddress; 685 fs_ecm_out_desc.bEndpointAddress;
686 hs_notify_desc.bEndpointAddress = 686 hs_ecm_notify_desc.bEndpointAddress =
687 fs_notify_desc.bEndpointAddress; 687 fs_ecm_notify_desc.bEndpointAddress;
688 688
689 /* copy descriptors, and track endpoint copies */ 689 /* copy descriptors, and track endpoint copies */
690 f->hs_descriptors = usb_copy_descriptors(eth_hs_function); 690 f->hs_descriptors = usb_copy_descriptors(ecm_hs_function);
691 if (!f->hs_descriptors) 691 if (!f->hs_descriptors)
692 goto fail; 692 goto fail;
693 693
694 ecm->hs.in = usb_find_endpoint(eth_hs_function, 694 ecm->hs.in = usb_find_endpoint(ecm_hs_function,
695 f->hs_descriptors, &hs_in_desc); 695 f->hs_descriptors, &hs_ecm_in_desc);
696 ecm->hs.out = usb_find_endpoint(eth_hs_function, 696 ecm->hs.out = usb_find_endpoint(ecm_hs_function,
697 f->hs_descriptors, &hs_out_desc); 697 f->hs_descriptors, &hs_ecm_out_desc);
698 ecm->hs.notify = usb_find_endpoint(eth_hs_function, 698 ecm->hs.notify = usb_find_endpoint(ecm_hs_function,
699 f->hs_descriptors, &hs_notify_desc); 699 f->hs_descriptors, &hs_ecm_notify_desc);
700 } 700 }
701 701
702 /* NOTE: all that is done without knowing or caring about 702 /* NOTE: all that is done without knowing or caring about
@@ -795,7 +795,7 @@ int __init ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN])
795 if (status < 0) 795 if (status < 0)
796 return status; 796 return status;
797 ecm_string_defs[1].id = status; 797 ecm_string_defs[1].id = status;
798 ether_desc.iMACAddress = status; 798 ecm_desc.iMACAddress = status;
799 } 799 }
800 800
801 /* allocate and initialize one new instance */ 801 /* allocate and initialize one new instance */
diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c
index acb8d233aa1d..fe1832875771 100644
--- a/drivers/usb/gadget/f_subset.c
+++ b/drivers/usb/gadget/f_subset.c
@@ -103,8 +103,8 @@ static struct usb_interface_descriptor subset_data_intf __initdata = {
103 /* .iInterface = DYNAMIC */ 103 /* .iInterface = DYNAMIC */
104}; 104};
105 105
106static struct usb_cdc_header_desc header_desc __initdata = { 106static struct usb_cdc_header_desc mdlm_header_desc __initdata = {
107 .bLength = sizeof header_desc, 107 .bLength = sizeof mdlm_header_desc,
108 .bDescriptorType = USB_DT_CS_INTERFACE, 108 .bDescriptorType = USB_DT_CS_INTERFACE,
109 .bDescriptorSubType = USB_CDC_HEADER_TYPE, 109 .bDescriptorSubType = USB_CDC_HEADER_TYPE,
110 110
@@ -152,7 +152,7 @@ static struct usb_cdc_ether_desc ether_desc __initdata = {
152 152
153/* full speed support: */ 153/* full speed support: */
154 154
155static struct usb_endpoint_descriptor fs_in_desc __initdata = { 155static struct usb_endpoint_descriptor fs_subset_in_desc __initdata = {
156 .bLength = USB_DT_ENDPOINT_SIZE, 156 .bLength = USB_DT_ENDPOINT_SIZE,
157 .bDescriptorType = USB_DT_ENDPOINT, 157 .bDescriptorType = USB_DT_ENDPOINT,
158 158
@@ -160,7 +160,7 @@ static struct usb_endpoint_descriptor fs_in_desc __initdata = {
160 .bmAttributes = USB_ENDPOINT_XFER_BULK, 160 .bmAttributes = USB_ENDPOINT_XFER_BULK,
161}; 161};
162 162
163static struct usb_endpoint_descriptor fs_out_desc __initdata = { 163static struct usb_endpoint_descriptor fs_subset_out_desc __initdata = {
164 .bLength = USB_DT_ENDPOINT_SIZE, 164 .bLength = USB_DT_ENDPOINT_SIZE,
165 .bDescriptorType = USB_DT_ENDPOINT, 165 .bDescriptorType = USB_DT_ENDPOINT,
166 166
@@ -170,18 +170,18 @@ static struct usb_endpoint_descriptor fs_out_desc __initdata = {
170 170
171static struct usb_descriptor_header *fs_eth_function[] __initdata = { 171static struct usb_descriptor_header *fs_eth_function[] __initdata = {
172 (struct usb_descriptor_header *) &subset_data_intf, 172 (struct usb_descriptor_header *) &subset_data_intf,
173 (struct usb_descriptor_header *) &header_desc, 173 (struct usb_descriptor_header *) &mdlm_header_desc,
174 (struct usb_descriptor_header *) &mdlm_desc, 174 (struct usb_descriptor_header *) &mdlm_desc,
175 (struct usb_descriptor_header *) &mdlm_detail_desc, 175 (struct usb_descriptor_header *) &mdlm_detail_desc,
176 (struct usb_descriptor_header *) &ether_desc, 176 (struct usb_descriptor_header *) &ether_desc,
177 (struct usb_descriptor_header *) &fs_in_desc, 177 (struct usb_descriptor_header *) &fs_subset_in_desc,
178 (struct usb_descriptor_header *) &fs_out_desc, 178 (struct usb_descriptor_header *) &fs_subset_out_desc,
179 NULL, 179 NULL,
180}; 180};
181 181
182/* high speed support: */ 182/* high speed support: */
183 183
184static struct usb_endpoint_descriptor hs_in_desc __initdata = { 184static struct usb_endpoint_descriptor hs_subset_in_desc __initdata = {
185 .bLength = USB_DT_ENDPOINT_SIZE, 185 .bLength = USB_DT_ENDPOINT_SIZE,
186 .bDescriptorType = USB_DT_ENDPOINT, 186 .bDescriptorType = USB_DT_ENDPOINT,
187 187
@@ -189,7 +189,7 @@ static struct usb_endpoint_descriptor hs_in_desc __initdata = {
189 .wMaxPacketSize = __constant_cpu_to_le16(512), 189 .wMaxPacketSize = __constant_cpu_to_le16(512),
190}; 190};
191 191
192static struct usb_endpoint_descriptor hs_out_desc __initdata = { 192static struct usb_endpoint_descriptor hs_subset_out_desc __initdata = {
193 .bLength = USB_DT_ENDPOINT_SIZE, 193 .bLength = USB_DT_ENDPOINT_SIZE,
194 .bDescriptorType = USB_DT_ENDPOINT, 194 .bDescriptorType = USB_DT_ENDPOINT,
195 195
@@ -199,12 +199,12 @@ static struct usb_endpoint_descriptor hs_out_desc __initdata = {
199 199
200static struct usb_descriptor_header *hs_eth_function[] __initdata = { 200static struct usb_descriptor_header *hs_eth_function[] __initdata = {
201 (struct usb_descriptor_header *) &subset_data_intf, 201 (struct usb_descriptor_header *) &subset_data_intf,
202 (struct usb_descriptor_header *) &header_desc, 202 (struct usb_descriptor_header *) &mdlm_header_desc,
203 (struct usb_descriptor_header *) &mdlm_desc, 203 (struct usb_descriptor_header *) &mdlm_desc,
204 (struct usb_descriptor_header *) &mdlm_detail_desc, 204 (struct usb_descriptor_header *) &mdlm_detail_desc,
205 (struct usb_descriptor_header *) &ether_desc, 205 (struct usb_descriptor_header *) &ether_desc,
206 (struct usb_descriptor_header *) &hs_in_desc, 206 (struct usb_descriptor_header *) &hs_subset_in_desc,
207 (struct usb_descriptor_header *) &hs_out_desc, 207 (struct usb_descriptor_header *) &hs_subset_out_desc,
208 NULL, 208 NULL,
209}; 209};
210 210
@@ -281,13 +281,13 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
281 status = -ENODEV; 281 status = -ENODEV;
282 282
283 /* allocate instance-specific endpoints */ 283 /* allocate instance-specific endpoints */
284 ep = usb_ep_autoconfig(cdev->gadget, &fs_in_desc); 284 ep = usb_ep_autoconfig(cdev->gadget, &fs_subset_in_desc);
285 if (!ep) 285 if (!ep)
286 goto fail; 286 goto fail;
287 geth->port.in_ep = ep; 287 geth->port.in_ep = ep;
288 ep->driver_data = cdev; /* claim */ 288 ep->driver_data = cdev; /* claim */
289 289
290 ep = usb_ep_autoconfig(cdev->gadget, &fs_out_desc); 290 ep = usb_ep_autoconfig(cdev->gadget, &fs_subset_out_desc);
291 if (!ep) 291 if (!ep)
292 goto fail; 292 goto fail;
293 geth->port.out_ep = ep; 293 geth->port.out_ep = ep;
@@ -297,9 +297,9 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
297 f->descriptors = usb_copy_descriptors(fs_eth_function); 297 f->descriptors = usb_copy_descriptors(fs_eth_function);
298 298
299 geth->fs.in = usb_find_endpoint(fs_eth_function, 299 geth->fs.in = usb_find_endpoint(fs_eth_function,
300 f->descriptors, &fs_in_desc); 300 f->descriptors, &fs_subset_in_desc);
301 geth->fs.out = usb_find_endpoint(fs_eth_function, 301 geth->fs.out = usb_find_endpoint(fs_eth_function,
302 f->descriptors, &fs_out_desc); 302 f->descriptors, &fs_subset_out_desc);
303 303
304 304
305 /* support all relevant hardware speeds... we expect that when 305 /* support all relevant hardware speeds... we expect that when
@@ -307,18 +307,18 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
307 * both speeds 307 * both speeds
308 */ 308 */
309 if (gadget_is_dualspeed(c->cdev->gadget)) { 309 if (gadget_is_dualspeed(c->cdev->gadget)) {
310 hs_in_desc.bEndpointAddress = 310 hs_subset_in_desc.bEndpointAddress =
311 fs_in_desc.bEndpointAddress; 311 fs_subset_in_desc.bEndpointAddress;
312 hs_out_desc.bEndpointAddress = 312 hs_subset_out_desc.bEndpointAddress =
313 fs_out_desc.bEndpointAddress; 313 fs_subset_out_desc.bEndpointAddress;
314 314
315 /* copy descriptors, and track endpoint copies */ 315 /* copy descriptors, and track endpoint copies */
316 f->hs_descriptors = usb_copy_descriptors(hs_eth_function); 316 f->hs_descriptors = usb_copy_descriptors(hs_eth_function);
317 317
318 geth->hs.in = usb_find_endpoint(hs_eth_function, 318 geth->hs.in = usb_find_endpoint(hs_eth_function,
319 f->hs_descriptors, &hs_in_desc); 319 f->hs_descriptors, &hs_subset_in_desc);
320 geth->hs.out = usb_find_endpoint(hs_eth_function, 320 geth->hs.out = usb_find_endpoint(hs_eth_function,
321 f->hs_descriptors, &hs_out_desc); 321 f->hs_descriptors, &hs_subset_out_desc);
322 } 322 }
323 323
324 /* NOTE: all that is done without knowing or caring about 324 /* NOTE: all that is done without knowing or caring about
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 7228e8562236..8c26f5ea2b83 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -57,11 +57,6 @@ MODULE_PARM_DESC (rndis_debug, "enable debugging");
57#define rndis_debug 0 57#define rndis_debug 0
58#endif 58#endif
59 59
60#define DBG(str,args...) do { \
61 if (rndis_debug) \
62 pr_debug(str , ## args); \
63 } while (0)
64
65#define RNDIS_MAX_CONFIGS 1 60#define RNDIS_MAX_CONFIGS 1
66 61
67 62
@@ -183,9 +178,9 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
183 if (!resp) return -ENOMEM; 178 if (!resp) return -ENOMEM;
184 179
185 if (buf_len && rndis_debug > 1) { 180 if (buf_len && rndis_debug > 1) {
186 DBG("query OID %08x value, len %d:\n", OID, buf_len); 181 pr_debug("query OID %08x value, len %d:\n", OID, buf_len);
187 for (i = 0; i < buf_len; i += 16) { 182 for (i = 0; i < buf_len; i += 16) {
188 DBG("%03d: %08x %08x %08x %08x\n", i, 183 pr_debug("%03d: %08x %08x %08x %08x\n", i,
189 get_unaligned_le32(&buf[i]), 184 get_unaligned_le32(&buf[i]),
190 get_unaligned_le32(&buf[i + 4]), 185 get_unaligned_le32(&buf[i + 4]),
191 get_unaligned_le32(&buf[i + 8]), 186 get_unaligned_le32(&buf[i + 8]),
@@ -209,7 +204,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
209 204
210 /* mandatory */ 205 /* mandatory */
211 case OID_GEN_SUPPORTED_LIST: 206 case OID_GEN_SUPPORTED_LIST:
212 DBG("%s: OID_GEN_SUPPORTED_LIST\n", __func__); 207 pr_debug("%s: OID_GEN_SUPPORTED_LIST\n", __func__);
213 length = sizeof (oid_supported_list); 208 length = sizeof (oid_supported_list);
214 count = length / sizeof (u32); 209 count = length / sizeof (u32);
215 for (i = 0; i < count; i++) 210 for (i = 0; i < count; i++)
@@ -219,7 +214,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
219 214
220 /* mandatory */ 215 /* mandatory */
221 case OID_GEN_HARDWARE_STATUS: 216 case OID_GEN_HARDWARE_STATUS:
222 DBG("%s: OID_GEN_HARDWARE_STATUS\n", __func__); 217 pr_debug("%s: OID_GEN_HARDWARE_STATUS\n", __func__);
223 /* Bogus question! 218 /* Bogus question!
224 * Hardware must be ready to receive high level protocols. 219 * Hardware must be ready to receive high level protocols.
225 * BTW: 220 * BTW:
@@ -232,14 +227,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
232 227
233 /* mandatory */ 228 /* mandatory */
234 case OID_GEN_MEDIA_SUPPORTED: 229 case OID_GEN_MEDIA_SUPPORTED:
235 DBG("%s: OID_GEN_MEDIA_SUPPORTED\n", __func__); 230 pr_debug("%s: OID_GEN_MEDIA_SUPPORTED\n", __func__);
236 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); 231 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium);
237 retval = 0; 232 retval = 0;
238 break; 233 break;
239 234
240 /* mandatory */ 235 /* mandatory */
241 case OID_GEN_MEDIA_IN_USE: 236 case OID_GEN_MEDIA_IN_USE:
242 DBG("%s: OID_GEN_MEDIA_IN_USE\n", __func__); 237 pr_debug("%s: OID_GEN_MEDIA_IN_USE\n", __func__);
243 /* one medium, one transport... (maybe you do it better) */ 238 /* one medium, one transport... (maybe you do it better) */
244 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); 239 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium);
245 retval = 0; 240 retval = 0;
@@ -247,7 +242,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
247 242
248 /* mandatory */ 243 /* mandatory */
249 case OID_GEN_MAXIMUM_FRAME_SIZE: 244 case OID_GEN_MAXIMUM_FRAME_SIZE:
250 DBG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __func__); 245 pr_debug("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __func__);
251 if (rndis_per_dev_params [configNr].dev) { 246 if (rndis_per_dev_params [configNr].dev) {
252 *outbuf = cpu_to_le32 ( 247 *outbuf = cpu_to_le32 (
253 rndis_per_dev_params [configNr].dev->mtu); 248 rndis_per_dev_params [configNr].dev->mtu);
@@ -258,7 +253,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
258 /* mandatory */ 253 /* mandatory */
259 case OID_GEN_LINK_SPEED: 254 case OID_GEN_LINK_SPEED:
260 if (rndis_debug > 1) 255 if (rndis_debug > 1)
261 DBG("%s: OID_GEN_LINK_SPEED\n", __func__); 256 pr_debug("%s: OID_GEN_LINK_SPEED\n", __func__);
262 if (rndis_per_dev_params [configNr].media_state 257 if (rndis_per_dev_params [configNr].media_state
263 == NDIS_MEDIA_STATE_DISCONNECTED) 258 == NDIS_MEDIA_STATE_DISCONNECTED)
264 *outbuf = __constant_cpu_to_le32 (0); 259 *outbuf = __constant_cpu_to_le32 (0);
@@ -270,7 +265,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
270 265
271 /* mandatory */ 266 /* mandatory */
272 case OID_GEN_TRANSMIT_BLOCK_SIZE: 267 case OID_GEN_TRANSMIT_BLOCK_SIZE:
273 DBG("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __func__); 268 pr_debug("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __func__);
274 if (rndis_per_dev_params [configNr].dev) { 269 if (rndis_per_dev_params [configNr].dev) {
275 *outbuf = cpu_to_le32 ( 270 *outbuf = cpu_to_le32 (
276 rndis_per_dev_params [configNr].dev->mtu); 271 rndis_per_dev_params [configNr].dev->mtu);
@@ -280,7 +275,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
280 275
281 /* mandatory */ 276 /* mandatory */
282 case OID_GEN_RECEIVE_BLOCK_SIZE: 277 case OID_GEN_RECEIVE_BLOCK_SIZE:
283 DBG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __func__); 278 pr_debug("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __func__);
284 if (rndis_per_dev_params [configNr].dev) { 279 if (rndis_per_dev_params [configNr].dev) {
285 *outbuf = cpu_to_le32 ( 280 *outbuf = cpu_to_le32 (
286 rndis_per_dev_params [configNr].dev->mtu); 281 rndis_per_dev_params [configNr].dev->mtu);
@@ -290,7 +285,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
290 285
291 /* mandatory */ 286 /* mandatory */
292 case OID_GEN_VENDOR_ID: 287 case OID_GEN_VENDOR_ID:
293 DBG("%s: OID_GEN_VENDOR_ID\n", __func__); 288 pr_debug("%s: OID_GEN_VENDOR_ID\n", __func__);
294 *outbuf = cpu_to_le32 ( 289 *outbuf = cpu_to_le32 (
295 rndis_per_dev_params [configNr].vendorID); 290 rndis_per_dev_params [configNr].vendorID);
296 retval = 0; 291 retval = 0;
@@ -298,7 +293,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
298 293
299 /* mandatory */ 294 /* mandatory */
300 case OID_GEN_VENDOR_DESCRIPTION: 295 case OID_GEN_VENDOR_DESCRIPTION:
301 DBG("%s: OID_GEN_VENDOR_DESCRIPTION\n", __func__); 296 pr_debug("%s: OID_GEN_VENDOR_DESCRIPTION\n", __func__);
302 length = strlen (rndis_per_dev_params [configNr].vendorDescr); 297 length = strlen (rndis_per_dev_params [configNr].vendorDescr);
303 memcpy (outbuf, 298 memcpy (outbuf,
304 rndis_per_dev_params [configNr].vendorDescr, length); 299 rndis_per_dev_params [configNr].vendorDescr, length);
@@ -306,7 +301,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
306 break; 301 break;
307 302
308 case OID_GEN_VENDOR_DRIVER_VERSION: 303 case OID_GEN_VENDOR_DRIVER_VERSION:
309 DBG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __func__); 304 pr_debug("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __func__);
310 /* Created as LE */ 305 /* Created as LE */
311 *outbuf = rndis_driver_version; 306 *outbuf = rndis_driver_version;
312 retval = 0; 307 retval = 0;
@@ -314,14 +309,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
314 309
315 /* mandatory */ 310 /* mandatory */
316 case OID_GEN_CURRENT_PACKET_FILTER: 311 case OID_GEN_CURRENT_PACKET_FILTER:
317 DBG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __func__); 312 pr_debug("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __func__);
318 *outbuf = cpu_to_le32 (*rndis_per_dev_params[configNr].filter); 313 *outbuf = cpu_to_le32 (*rndis_per_dev_params[configNr].filter);
319 retval = 0; 314 retval = 0;
320 break; 315 break;
321 316
322 /* mandatory */ 317 /* mandatory */
323 case OID_GEN_MAXIMUM_TOTAL_SIZE: 318 case OID_GEN_MAXIMUM_TOTAL_SIZE:
324 DBG("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __func__); 319 pr_debug("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __func__);
325 *outbuf = __constant_cpu_to_le32(RNDIS_MAX_TOTAL_SIZE); 320 *outbuf = __constant_cpu_to_le32(RNDIS_MAX_TOTAL_SIZE);
326 retval = 0; 321 retval = 0;
327 break; 322 break;
@@ -329,14 +324,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
329 /* mandatory */ 324 /* mandatory */
330 case OID_GEN_MEDIA_CONNECT_STATUS: 325 case OID_GEN_MEDIA_CONNECT_STATUS:
331 if (rndis_debug > 1) 326 if (rndis_debug > 1)
332 DBG("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __func__); 327 pr_debug("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __func__);
333 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] 328 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr]
334 .media_state); 329 .media_state);
335 retval = 0; 330 retval = 0;
336 break; 331 break;
337 332
338 case OID_GEN_PHYSICAL_MEDIUM: 333 case OID_GEN_PHYSICAL_MEDIUM:
339 DBG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __func__); 334 pr_debug("%s: OID_GEN_PHYSICAL_MEDIUM\n", __func__);
340 *outbuf = __constant_cpu_to_le32 (0); 335 *outbuf = __constant_cpu_to_le32 (0);
341 retval = 0; 336 retval = 0;
342 break; 337 break;
@@ -346,7 +341,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
346 * versions emit undefined RNDIS messages. DOCUMENT ALL THESE! 341 * versions emit undefined RNDIS messages. DOCUMENT ALL THESE!
347 */ 342 */
348 case OID_GEN_MAC_OPTIONS: /* from WinME */ 343 case OID_GEN_MAC_OPTIONS: /* from WinME */
349 DBG("%s: OID_GEN_MAC_OPTIONS\n", __func__); 344 pr_debug("%s: OID_GEN_MAC_OPTIONS\n", __func__);
350 *outbuf = __constant_cpu_to_le32( 345 *outbuf = __constant_cpu_to_le32(
351 NDIS_MAC_OPTION_RECEIVE_SERIALIZED 346 NDIS_MAC_OPTION_RECEIVE_SERIALIZED
352 | NDIS_MAC_OPTION_FULL_DUPLEX); 347 | NDIS_MAC_OPTION_FULL_DUPLEX);
@@ -358,7 +353,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
358 /* mandatory */ 353 /* mandatory */
359 case OID_GEN_XMIT_OK: 354 case OID_GEN_XMIT_OK:
360 if (rndis_debug > 1) 355 if (rndis_debug > 1)
361 DBG("%s: OID_GEN_XMIT_OK\n", __func__); 356 pr_debug("%s: OID_GEN_XMIT_OK\n", __func__);
362 if (stats) { 357 if (stats) {
363 *outbuf = cpu_to_le32(stats->tx_packets 358 *outbuf = cpu_to_le32(stats->tx_packets
364 - stats->tx_errors - stats->tx_dropped); 359 - stats->tx_errors - stats->tx_dropped);
@@ -369,7 +364,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
369 /* mandatory */ 364 /* mandatory */
370 case OID_GEN_RCV_OK: 365 case OID_GEN_RCV_OK:
371 if (rndis_debug > 1) 366 if (rndis_debug > 1)
372 DBG("%s: OID_GEN_RCV_OK\n", __func__); 367 pr_debug("%s: OID_GEN_RCV_OK\n", __func__);
373 if (stats) { 368 if (stats) {
374 *outbuf = cpu_to_le32(stats->rx_packets 369 *outbuf = cpu_to_le32(stats->rx_packets
375 - stats->rx_errors - stats->rx_dropped); 370 - stats->rx_errors - stats->rx_dropped);
@@ -380,7 +375,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
380 /* mandatory */ 375 /* mandatory */
381 case OID_GEN_XMIT_ERROR: 376 case OID_GEN_XMIT_ERROR:
382 if (rndis_debug > 1) 377 if (rndis_debug > 1)
383 DBG("%s: OID_GEN_XMIT_ERROR\n", __func__); 378 pr_debug("%s: OID_GEN_XMIT_ERROR\n", __func__);
384 if (stats) { 379 if (stats) {
385 *outbuf = cpu_to_le32(stats->tx_errors); 380 *outbuf = cpu_to_le32(stats->tx_errors);
386 retval = 0; 381 retval = 0;
@@ -390,7 +385,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
390 /* mandatory */ 385 /* mandatory */
391 case OID_GEN_RCV_ERROR: 386 case OID_GEN_RCV_ERROR:
392 if (rndis_debug > 1) 387 if (rndis_debug > 1)
393 DBG("%s: OID_GEN_RCV_ERROR\n", __func__); 388 pr_debug("%s: OID_GEN_RCV_ERROR\n", __func__);
394 if (stats) { 389 if (stats) {
395 *outbuf = cpu_to_le32(stats->rx_errors); 390 *outbuf = cpu_to_le32(stats->rx_errors);
396 retval = 0; 391 retval = 0;
@@ -399,7 +394,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
399 394
400 /* mandatory */ 395 /* mandatory */
401 case OID_GEN_RCV_NO_BUFFER: 396 case OID_GEN_RCV_NO_BUFFER:
402 DBG("%s: OID_GEN_RCV_NO_BUFFER\n", __func__); 397 pr_debug("%s: OID_GEN_RCV_NO_BUFFER\n", __func__);
403 if (stats) { 398 if (stats) {
404 *outbuf = cpu_to_le32(stats->rx_dropped); 399 *outbuf = cpu_to_le32(stats->rx_dropped);
405 retval = 0; 400 retval = 0;
@@ -410,7 +405,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
410 405
411 /* mandatory */ 406 /* mandatory */
412 case OID_802_3_PERMANENT_ADDRESS: 407 case OID_802_3_PERMANENT_ADDRESS:
413 DBG("%s: OID_802_3_PERMANENT_ADDRESS\n", __func__); 408 pr_debug("%s: OID_802_3_PERMANENT_ADDRESS\n", __func__);
414 if (rndis_per_dev_params [configNr].dev) { 409 if (rndis_per_dev_params [configNr].dev) {
415 length = ETH_ALEN; 410 length = ETH_ALEN;
416 memcpy (outbuf, 411 memcpy (outbuf,
@@ -422,7 +417,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
422 417
423 /* mandatory */ 418 /* mandatory */
424 case OID_802_3_CURRENT_ADDRESS: 419 case OID_802_3_CURRENT_ADDRESS:
425 DBG("%s: OID_802_3_CURRENT_ADDRESS\n", __func__); 420 pr_debug("%s: OID_802_3_CURRENT_ADDRESS\n", __func__);
426 if (rndis_per_dev_params [configNr].dev) { 421 if (rndis_per_dev_params [configNr].dev) {
427 length = ETH_ALEN; 422 length = ETH_ALEN;
428 memcpy (outbuf, 423 memcpy (outbuf,
@@ -434,7 +429,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
434 429
435 /* mandatory */ 430 /* mandatory */
436 case OID_802_3_MULTICAST_LIST: 431 case OID_802_3_MULTICAST_LIST:
437 DBG("%s: OID_802_3_MULTICAST_LIST\n", __func__); 432 pr_debug("%s: OID_802_3_MULTICAST_LIST\n", __func__);
438 /* Multicast base address only */ 433 /* Multicast base address only */
439 *outbuf = __constant_cpu_to_le32 (0xE0000000); 434 *outbuf = __constant_cpu_to_le32 (0xE0000000);
440 retval = 0; 435 retval = 0;
@@ -442,21 +437,21 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
442 437
443 /* mandatory */ 438 /* mandatory */
444 case OID_802_3_MAXIMUM_LIST_SIZE: 439 case OID_802_3_MAXIMUM_LIST_SIZE:
445 DBG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __func__); 440 pr_debug("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __func__);
446 /* Multicast base address only */ 441 /* Multicast base address only */
447 *outbuf = __constant_cpu_to_le32 (1); 442 *outbuf = __constant_cpu_to_le32 (1);
448 retval = 0; 443 retval = 0;
449 break; 444 break;
450 445
451 case OID_802_3_MAC_OPTIONS: 446 case OID_802_3_MAC_OPTIONS:
452 DBG("%s: OID_802_3_MAC_OPTIONS\n", __func__); 447 pr_debug("%s: OID_802_3_MAC_OPTIONS\n", __func__);
453 break; 448 break;
454 449
455 /* ieee802.3 statistics OIDs (table 4-4) */ 450 /* ieee802.3 statistics OIDs (table 4-4) */
456 451
457 /* mandatory */ 452 /* mandatory */
458 case OID_802_3_RCV_ERROR_ALIGNMENT: 453 case OID_802_3_RCV_ERROR_ALIGNMENT:
459 DBG("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __func__); 454 pr_debug("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __func__);
460 if (stats) { 455 if (stats) {
461 *outbuf = cpu_to_le32(stats->rx_frame_errors); 456 *outbuf = cpu_to_le32(stats->rx_frame_errors);
462 retval = 0; 457 retval = 0;
@@ -465,14 +460,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
465 460
466 /* mandatory */ 461 /* mandatory */
467 case OID_802_3_XMIT_ONE_COLLISION: 462 case OID_802_3_XMIT_ONE_COLLISION:
468 DBG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __func__); 463 pr_debug("%s: OID_802_3_XMIT_ONE_COLLISION\n", __func__);
469 *outbuf = __constant_cpu_to_le32 (0); 464 *outbuf = __constant_cpu_to_le32 (0);
470 retval = 0; 465 retval = 0;
471 break; 466 break;
472 467
473 /* mandatory */ 468 /* mandatory */
474 case OID_802_3_XMIT_MORE_COLLISIONS: 469 case OID_802_3_XMIT_MORE_COLLISIONS:
475 DBG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __func__); 470 pr_debug("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __func__);
476 *outbuf = __constant_cpu_to_le32 (0); 471 *outbuf = __constant_cpu_to_le32 (0);
477 retval = 0; 472 retval = 0;
478 break; 473 break;
@@ -504,9 +499,9 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
504 return -ENOMEM; 499 return -ENOMEM;
505 500
506 if (buf_len && rndis_debug > 1) { 501 if (buf_len && rndis_debug > 1) {
507 DBG("set OID %08x value, len %d:\n", OID, buf_len); 502 pr_debug("set OID %08x value, len %d:\n", OID, buf_len);
508 for (i = 0; i < buf_len; i += 16) { 503 for (i = 0; i < buf_len; i += 16) {
509 DBG("%03d: %08x %08x %08x %08x\n", i, 504 pr_debug("%03d: %08x %08x %08x %08x\n", i,
510 get_unaligned_le32(&buf[i]), 505 get_unaligned_le32(&buf[i]),
511 get_unaligned_le32(&buf[i + 4]), 506 get_unaligned_le32(&buf[i + 4]),
512 get_unaligned_le32(&buf[i + 8]), 507 get_unaligned_le32(&buf[i + 8]),
@@ -525,7 +520,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
525 * MULTICAST, ALL_MULTICAST, BROADCAST 520 * MULTICAST, ALL_MULTICAST, BROADCAST
526 */ 521 */
527 *params->filter = (u16)get_unaligned_le32(buf); 522 *params->filter = (u16)get_unaligned_le32(buf);
528 DBG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", 523 pr_debug("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n",
529 __func__, *params->filter); 524 __func__, *params->filter);
530 525
531 /* this call has a significant side effect: it's 526 /* this call has a significant side effect: it's
@@ -547,7 +542,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
547 542
548 case OID_802_3_MULTICAST_LIST: 543 case OID_802_3_MULTICAST_LIST:
549 /* I think we can ignore this */ 544 /* I think we can ignore this */
550 DBG("%s: OID_802_3_MULTICAST_LIST\n", __func__); 545 pr_debug("%s: OID_802_3_MULTICAST_LIST\n", __func__);
551 retval = 0; 546 retval = 0;
552 break; 547 break;
553 548
@@ -606,7 +601,7 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf)
606 rndis_resp_t *r; 601 rndis_resp_t *r;
607 struct rndis_params *params = rndis_per_dev_params + configNr; 602 struct rndis_params *params = rndis_per_dev_params + configNr;
608 603
609 // DBG("%s: OID = %08X\n", __func__, cpu_to_le32(buf->OID)); 604 /* pr_debug("%s: OID = %08X\n", __func__, cpu_to_le32(buf->OID)); */
610 if (!params->dev) 605 if (!params->dev)
611 return -ENOTSUPP; 606 return -ENOTSUPP;
612 607
@@ -659,15 +654,15 @@ static int rndis_set_response (int configNr, rndis_set_msg_type *buf)
659 BufOffset = le32_to_cpu (buf->InformationBufferOffset); 654 BufOffset = le32_to_cpu (buf->InformationBufferOffset);
660 655
661#ifdef VERBOSE_DEBUG 656#ifdef VERBOSE_DEBUG
662 DBG("%s: Length: %d\n", __func__, BufLength); 657 pr_debug("%s: Length: %d\n", __func__, BufLength);
663 DBG("%s: Offset: %d\n", __func__, BufOffset); 658 pr_debug("%s: Offset: %d\n", __func__, BufOffset);
664 DBG("%s: InfoBuffer: ", __func__); 659 pr_debug("%s: InfoBuffer: ", __func__);
665 660
666 for (i = 0; i < BufLength; i++) { 661 for (i = 0; i < BufLength; i++) {
667 DBG("%02x ", *(((u8 *) buf) + i + 8 + BufOffset)); 662 pr_debug("%02x ", *(((u8 *) buf) + i + 8 + BufOffset));
668 } 663 }
669 664
670 DBG("\n"); 665 pr_debug("\n");
671#endif 666#endif
672 667
673 resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT); 668 resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT);
@@ -821,14 +816,14 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
821 /* For USB: responses may take up to 10 seconds */ 816 /* For USB: responses may take up to 10 seconds */
822 switch (MsgType) { 817 switch (MsgType) {
823 case REMOTE_NDIS_INITIALIZE_MSG: 818 case REMOTE_NDIS_INITIALIZE_MSG:
824 DBG("%s: REMOTE_NDIS_INITIALIZE_MSG\n", 819 pr_debug("%s: REMOTE_NDIS_INITIALIZE_MSG\n",
825 __func__ ); 820 __func__ );
826 params->state = RNDIS_INITIALIZED; 821 params->state = RNDIS_INITIALIZED;
827 return rndis_init_response (configNr, 822 return rndis_init_response (configNr,
828 (rndis_init_msg_type *) buf); 823 (rndis_init_msg_type *) buf);
829 824
830 case REMOTE_NDIS_HALT_MSG: 825 case REMOTE_NDIS_HALT_MSG:
831 DBG("%s: REMOTE_NDIS_HALT_MSG\n", 826 pr_debug("%s: REMOTE_NDIS_HALT_MSG\n",
832 __func__ ); 827 __func__ );
833 params->state = RNDIS_UNINITIALIZED; 828 params->state = RNDIS_UNINITIALIZED;
834 if (params->dev) { 829 if (params->dev) {
@@ -846,7 +841,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
846 (rndis_set_msg_type *) buf); 841 (rndis_set_msg_type *) buf);
847 842
848 case REMOTE_NDIS_RESET_MSG: 843 case REMOTE_NDIS_RESET_MSG:
849 DBG("%s: REMOTE_NDIS_RESET_MSG\n", 844 pr_debug("%s: REMOTE_NDIS_RESET_MSG\n",
850 __func__ ); 845 __func__ );
851 return rndis_reset_response (configNr, 846 return rndis_reset_response (configNr,
852 (rndis_reset_msg_type *) buf); 847 (rndis_reset_msg_type *) buf);
@@ -854,7 +849,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
854 case REMOTE_NDIS_KEEPALIVE_MSG: 849 case REMOTE_NDIS_KEEPALIVE_MSG:
855 /* For USB: host does this every 5 seconds */ 850 /* For USB: host does this every 5 seconds */
856 if (rndis_debug > 1) 851 if (rndis_debug > 1)
857 DBG("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", 852 pr_debug("%s: REMOTE_NDIS_KEEPALIVE_MSG\n",
858 __func__ ); 853 __func__ );
859 return rndis_keepalive_response (configNr, 854 return rndis_keepalive_response (configNr,
860 (rndis_keepalive_msg_type *) 855 (rndis_keepalive_msg_type *)
@@ -870,7 +865,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
870 { 865 {
871 unsigned i; 866 unsigned i;
872 for (i = 0; i < MsgLength; i += 16) { 867 for (i = 0; i < MsgLength; i += 16) {
873 DBG("%03d: " 868 pr_debug("%03d: "
874 " %02x %02x %02x %02x" 869 " %02x %02x %02x %02x"
875 " %02x %02x %02x %02x" 870 " %02x %02x %02x %02x"
876 " %02x %02x %02x %02x" 871 " %02x %02x %02x %02x"
@@ -905,18 +900,18 @@ int rndis_register(void (*resp_avail)(void *v), void *v)
905 rndis_per_dev_params [i].used = 1; 900 rndis_per_dev_params [i].used = 1;
906 rndis_per_dev_params [i].resp_avail = resp_avail; 901 rndis_per_dev_params [i].resp_avail = resp_avail;
907 rndis_per_dev_params [i].v = v; 902 rndis_per_dev_params [i].v = v;
908 DBG("%s: configNr = %d\n", __func__, i); 903 pr_debug("%s: configNr = %d\n", __func__, i);
909 return i; 904 return i;
910 } 905 }
911 } 906 }
912 DBG("failed\n"); 907 pr_debug("failed\n");
913 908
914 return -ENODEV; 909 return -ENODEV;
915} 910}
916 911
917void rndis_deregister (int configNr) 912void rndis_deregister (int configNr)
918{ 913{
919 DBG("%s: \n", __func__ ); 914 pr_debug("%s: \n", __func__);
920 915
921 if (configNr >= RNDIS_MAX_CONFIGS) return; 916 if (configNr >= RNDIS_MAX_CONFIGS) return;
922 rndis_per_dev_params [configNr].used = 0; 917 rndis_per_dev_params [configNr].used = 0;
@@ -926,7 +921,7 @@ void rndis_deregister (int configNr)
926 921
927int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter) 922int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter)
928{ 923{
929 DBG("%s:\n", __func__ ); 924 pr_debug("%s:\n", __func__);
930 if (!dev) 925 if (!dev)
931 return -EINVAL; 926 return -EINVAL;
932 if (configNr >= RNDIS_MAX_CONFIGS) return -1; 927 if (configNr >= RNDIS_MAX_CONFIGS) return -1;
@@ -939,7 +934,7 @@ int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter)
939 934
940int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr) 935int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr)
941{ 936{
942 DBG("%s:\n", __func__ ); 937 pr_debug("%s:\n", __func__);
943 if (!vendorDescr) return -1; 938 if (!vendorDescr) return -1;
944 if (configNr >= RNDIS_MAX_CONFIGS) return -1; 939 if (configNr >= RNDIS_MAX_CONFIGS) return -1;
945 940
@@ -951,7 +946,7 @@ int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr)
951 946
952int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed) 947int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed)
953{ 948{
954 DBG("%s: %u %u\n", __func__, medium, speed); 949 pr_debug("%s: %u %u\n", __func__, medium, speed);
955 if (configNr >= RNDIS_MAX_CONFIGS) return -1; 950 if (configNr >= RNDIS_MAX_CONFIGS) return -1;
956 951
957 rndis_per_dev_params [configNr].medium = medium; 952 rndis_per_dev_params [configNr].medium = medium;
@@ -1114,7 +1109,7 @@ static ssize_t rndis_proc_write(struct file *file, const char __user *buffer,
1114 break; 1109 break;
1115 default: 1110 default:
1116 if (fl_speed) p->speed = speed; 1111 if (fl_speed) p->speed = speed;
1117 else DBG("%c is not valid\n", c); 1112 else pr_debug("%c is not valid\n", c);
1118 break; 1113 break;
1119 } 1114 }
1120 1115
@@ -1159,12 +1154,12 @@ int __init rndis_init (void)
1159 &rndis_proc_fops, 1154 &rndis_proc_fops,
1160 (void *)(rndis_per_dev_params + i)))) 1155 (void *)(rndis_per_dev_params + i))))
1161 { 1156 {
1162 DBG("%s :remove entries", __func__); 1157 pr_debug("%s :remove entries", __func__);
1163 while (i) { 1158 while (i) {
1164 sprintf (name, NAME_TEMPLATE, --i); 1159 sprintf (name, NAME_TEMPLATE, --i);
1165 remove_proc_entry (name, NULL); 1160 remove_proc_entry (name, NULL);
1166 } 1161 }
1167 DBG("\n"); 1162 pr_debug("\n");
1168 return -EIO; 1163 return -EIO;
1169 } 1164 }
1170#endif 1165#endif