Linux 2.6.33-rc8
[linux-2.6/lguest.git] / drivers / net / usb / cdc_ether.c
blob4f27f022fbf7b93bb65aace8189e3b3039192b61
1 /*
2 * CDC Ethernet based networking peripherals
3 * Copyright (C) 2003-2005 by David Brownell
4 * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 // #define DEBUG // error path messages, extra info
22 // #define VERBOSE // more; success messages
24 #include <linux/module.h>
25 #include <linux/init.h>
26 #include <linux/netdevice.h>
27 #include <linux/etherdevice.h>
28 #include <linux/ethtool.h>
29 #include <linux/workqueue.h>
30 #include <linux/mii.h>
31 #include <linux/usb.h>
32 #include <linux/usb/cdc.h>
33 #include <linux/usb/usbnet.h>
36 #if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE)
38 static int is_rndis(struct usb_interface_descriptor *desc)
40 return (desc->bInterfaceClass == USB_CLASS_COMM &&
41 desc->bInterfaceSubClass == 2 &&
42 desc->bInterfaceProtocol == 0xff);
45 static int is_activesync(struct usb_interface_descriptor *desc)
47 return (desc->bInterfaceClass == USB_CLASS_MISC &&
48 desc->bInterfaceSubClass == 1 &&
49 desc->bInterfaceProtocol == 1);
52 static int is_wireless_rndis(struct usb_interface_descriptor *desc)
54 return (desc->bInterfaceClass == USB_CLASS_WIRELESS_CONTROLLER &&
55 desc->bInterfaceSubClass == 1 &&
56 desc->bInterfaceProtocol == 3);
59 #else
61 #define is_rndis(desc) 0
62 #define is_activesync(desc) 0
63 #define is_wireless_rndis(desc) 0
65 #endif
68 * probes control interface, claims data interface, collects the bulk
69 * endpoints, activates data interface (if needed), maybe sets MTU.
70 * all pure cdc, except for certain firmware workarounds, and knowing
71 * that rndis uses one different rule.
73 int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
75 u8 *buf = intf->cur_altsetting->extra;
76 int len = intf->cur_altsetting->extralen;
77 struct usb_interface_descriptor *d;
78 struct cdc_state *info = (void *) &dev->data;
79 int status;
80 int rndis;
81 struct usb_driver *driver = driver_of(intf);
83 if (sizeof dev->data < sizeof *info)
84 return -EDOM;
86 /* expect strict spec conformance for the descriptors, but
87 * cope with firmware which stores them in the wrong place
89 if (len == 0 && dev->udev->actconfig->extralen) {
90 /* Motorola SB4100 (and others: Brad Hards says it's
91 * from a Broadcom design) put CDC descriptors here
93 buf = dev->udev->actconfig->extra;
94 len = dev->udev->actconfig->extralen;
95 if (len)
96 dev_dbg(&intf->dev,
97 "CDC descriptors on config\n");
100 /* Maybe CDC descriptors are after the endpoint? This bug has
101 * been seen on some 2Wire Inc RNDIS-ish products.
103 if (len == 0) {
104 struct usb_host_endpoint *hep;
106 hep = intf->cur_altsetting->endpoint;
107 if (hep) {
108 buf = hep->extra;
109 len = hep->extralen;
111 if (len)
112 dev_dbg(&intf->dev,
113 "CDC descriptors on endpoint\n");
116 /* this assumes that if there's a non-RNDIS vendor variant
117 * of cdc-acm, it'll fail RNDIS requests cleanly.
119 rndis = (is_rndis(&intf->cur_altsetting->desc) ||
120 is_activesync(&intf->cur_altsetting->desc) ||
121 is_wireless_rndis(&intf->cur_altsetting->desc));
123 memset(info, 0, sizeof *info);
124 info->control = intf;
125 while (len > 3) {
126 if (buf [1] != USB_DT_CS_INTERFACE)
127 goto next_desc;
129 /* use bDescriptorSubType to identify the CDC descriptors.
130 * We expect devices with CDC header and union descriptors.
131 * For CDC Ethernet we need the ethernet descriptor.
132 * For RNDIS, ignore two (pointless) CDC modem descriptors
133 * in favor of a complicated OID-based RPC scheme doing what
134 * CDC Ethernet achieves with a simple descriptor.
136 switch (buf [2]) {
137 case USB_CDC_HEADER_TYPE:
138 if (info->header) {
139 dev_dbg(&intf->dev, "extra CDC header\n");
140 goto bad_desc;
142 info->header = (void *) buf;
143 if (info->header->bLength != sizeof *info->header) {
144 dev_dbg(&intf->dev, "CDC header len %u\n",
145 info->header->bLength);
146 goto bad_desc;
148 break;
149 case USB_CDC_ACM_TYPE:
150 /* paranoia: disambiguate a "real" vendor-specific
151 * modem interface from an RNDIS non-modem.
153 if (rndis) {
154 struct usb_cdc_acm_descriptor *acm;
156 acm = (void *) buf;
157 if (acm->bmCapabilities) {
158 dev_dbg(&intf->dev,
159 "ACM capabilities %02x, "
160 "not really RNDIS?\n",
161 acm->bmCapabilities);
162 goto bad_desc;
165 break;
166 case USB_CDC_UNION_TYPE:
167 if (info->u) {
168 dev_dbg(&intf->dev, "extra CDC union\n");
169 goto bad_desc;
171 info->u = (void *) buf;
172 if (info->u->bLength != sizeof *info->u) {
173 dev_dbg(&intf->dev, "CDC union len %u\n",
174 info->u->bLength);
175 goto bad_desc;
178 /* we need a master/control interface (what we're
179 * probed with) and a slave/data interface; union
180 * descriptors sort this all out.
182 info->control = usb_ifnum_to_if(dev->udev,
183 info->u->bMasterInterface0);
184 info->data = usb_ifnum_to_if(dev->udev,
185 info->u->bSlaveInterface0);
186 if (!info->control || !info->data) {
187 dev_dbg(&intf->dev,
188 "master #%u/%p slave #%u/%p\n",
189 info->u->bMasterInterface0,
190 info->control,
191 info->u->bSlaveInterface0,
192 info->data);
193 goto bad_desc;
195 if (info->control != intf) {
196 dev_dbg(&intf->dev, "bogus CDC Union\n");
197 /* Ambit USB Cable Modem (and maybe others)
198 * interchanges master and slave interface.
200 if (info->data == intf) {
201 info->data = info->control;
202 info->control = intf;
203 } else
204 goto bad_desc;
207 /* a data interface altsetting does the real i/o */
208 d = &info->data->cur_altsetting->desc;
209 if (d->bInterfaceClass != USB_CLASS_CDC_DATA) {
210 dev_dbg(&intf->dev, "slave class %u\n",
211 d->bInterfaceClass);
212 goto bad_desc;
214 break;
215 case USB_CDC_ETHERNET_TYPE:
216 if (info->ether) {
217 dev_dbg(&intf->dev, "extra CDC ether\n");
218 goto bad_desc;
220 info->ether = (void *) buf;
221 if (info->ether->bLength != sizeof *info->ether) {
222 dev_dbg(&intf->dev, "CDC ether len %u\n",
223 info->ether->bLength);
224 goto bad_desc;
226 dev->hard_mtu = le16_to_cpu(
227 info->ether->wMaxSegmentSize);
228 /* because of Zaurus, we may be ignoring the host
229 * side link address we were given.
231 break;
233 next_desc:
234 len -= buf [0]; /* bLength */
235 buf += buf [0];
238 /* Microsoft ActiveSync based and some regular RNDIS devices lack the
239 * CDC descriptors, so we'll hard-wire the interfaces and not check
240 * for descriptors.
242 if (rndis && !info->u) {
243 info->control = usb_ifnum_to_if(dev->udev, 0);
244 info->data = usb_ifnum_to_if(dev->udev, 1);
245 if (!info->control || !info->data) {
246 dev_dbg(&intf->dev,
247 "rndis: master #0/%p slave #1/%p\n",
248 info->control,
249 info->data);
250 goto bad_desc;
253 } else if (!info->header || !info->u || (!rndis && !info->ether)) {
254 dev_dbg(&intf->dev, "missing cdc %s%s%sdescriptor\n",
255 info->header ? "" : "header ",
256 info->u ? "" : "union ",
257 info->ether ? "" : "ether ");
258 goto bad_desc;
261 /* claim data interface and set it up ... with side effects.
262 * network traffic can't flow until an altsetting is enabled.
264 status = usb_driver_claim_interface(driver, info->data, dev);
265 if (status < 0)
266 return status;
267 status = usbnet_get_endpoints(dev, info->data);
268 if (status < 0) {
269 /* ensure immediate exit from usbnet_disconnect */
270 usb_set_intfdata(info->data, NULL);
271 usb_driver_release_interface(driver, info->data);
272 return status;
275 /* status endpoint: optional for CDC Ethernet, not RNDIS (or ACM) */
276 dev->status = NULL;
277 if (info->control->cur_altsetting->desc.bNumEndpoints == 1) {
278 struct usb_endpoint_descriptor *desc;
280 dev->status = &info->control->cur_altsetting->endpoint [0];
281 desc = &dev->status->desc;
282 if (!usb_endpoint_is_int_in(desc) ||
283 (le16_to_cpu(desc->wMaxPacketSize)
284 < sizeof(struct usb_cdc_notification)) ||
285 !desc->bInterval) {
286 dev_dbg(&intf->dev, "bad notification endpoint\n");
287 dev->status = NULL;
290 if (rndis && !dev->status) {
291 dev_dbg(&intf->dev, "missing RNDIS status endpoint\n");
292 usb_set_intfdata(info->data, NULL);
293 usb_driver_release_interface(driver, info->data);
294 return -ENODEV;
296 return 0;
298 bad_desc:
299 dev_info(&dev->udev->dev, "bad CDC descriptors\n");
300 return -ENODEV;
302 EXPORT_SYMBOL_GPL(usbnet_generic_cdc_bind);
304 void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
306 struct cdc_state *info = (void *) &dev->data;
307 struct usb_driver *driver = driver_of(intf);
309 /* disconnect master --> disconnect slave */
310 if (intf == info->control && info->data) {
311 /* ensure immediate exit from usbnet_disconnect */
312 usb_set_intfdata(info->data, NULL);
313 usb_driver_release_interface(driver, info->data);
314 info->data = NULL;
317 /* and vice versa (just in case) */
318 else if (intf == info->data && info->control) {
319 /* ensure immediate exit from usbnet_disconnect */
320 usb_set_intfdata(info->control, NULL);
321 usb_driver_release_interface(driver, info->control);
322 info->control = NULL;
325 EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
327 /*-------------------------------------------------------------------------
329 * Communications Device Class, Ethernet Control model
331 * Takes two interfaces. The DATA interface is inactive till an altsetting
332 * is selected. Configuration data includes class descriptors. There's
333 * an optional status endpoint on the control interface.
335 * This should interop with whatever the 2.4 "CDCEther.c" driver
336 * (by Brad Hards) talked with, with more functionality.
338 *-------------------------------------------------------------------------*/
340 static void dumpspeed(struct usbnet *dev, __le32 *speeds)
342 if (netif_msg_timer(dev))
343 devinfo(dev, "link speeds: %u kbps up, %u kbps down",
344 __le32_to_cpu(speeds[0]) / 1000,
345 __le32_to_cpu(speeds[1]) / 1000);
348 static void cdc_status(struct usbnet *dev, struct urb *urb)
350 struct usb_cdc_notification *event;
352 if (urb->actual_length < sizeof *event)
353 return;
355 /* SPEED_CHANGE can get split into two 8-byte packets */
356 if (test_and_clear_bit(EVENT_STS_SPLIT, &dev->flags)) {
357 dumpspeed(dev, (__le32 *) urb->transfer_buffer);
358 return;
361 event = urb->transfer_buffer;
362 switch (event->bNotificationType) {
363 case USB_CDC_NOTIFY_NETWORK_CONNECTION:
364 if (netif_msg_timer(dev))
365 devdbg(dev, "CDC: carrier %s",
366 event->wValue ? "on" : "off");
367 if (event->wValue)
368 netif_carrier_on(dev->net);
369 else
370 netif_carrier_off(dev->net);
371 break;
372 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */
373 if (netif_msg_timer(dev))
374 devdbg(dev, "CDC: speed change (len %d)",
375 urb->actual_length);
376 if (urb->actual_length != (sizeof *event + 8))
377 set_bit(EVENT_STS_SPLIT, &dev->flags);
378 else
379 dumpspeed(dev, (__le32 *) &event[1]);
380 break;
381 /* USB_CDC_NOTIFY_RESPONSE_AVAILABLE can happen too (e.g. RNDIS),
382 * but there are no standard formats for the response data.
384 default:
385 deverr(dev, "CDC: unexpected notification %02x!",
386 event->bNotificationType);
387 break;
391 static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)
393 int status;
394 struct cdc_state *info = (void *) &dev->data;
396 status = usbnet_generic_cdc_bind(dev, intf);
397 if (status < 0)
398 return status;
400 status = usbnet_get_ethernet_addr(dev, info->ether->iMACAddress);
401 if (status < 0) {
402 usb_set_intfdata(info->data, NULL);
403 usb_driver_release_interface(driver_of(intf), info->data);
404 return status;
407 /* FIXME cdc-ether has some multicast code too, though it complains
408 * in routine cases. info->ether describes the multicast support.
409 * Implement that here, manipulating the cdc filter as needed.
411 return 0;
414 static int cdc_manage_power(struct usbnet *dev, int on)
416 dev->intf->needs_remote_wakeup = on;
417 return 0;
420 static const struct driver_info cdc_info = {
421 .description = "CDC Ethernet Device",
422 .flags = FLAG_ETHER,
423 // .check_connect = cdc_check_connect,
424 .bind = cdc_bind,
425 .unbind = usbnet_cdc_unbind,
426 .status = cdc_status,
427 .manage_power = cdc_manage_power,
430 static const struct driver_info mbm_info = {
431 .description = "Mobile Broadband Network Device",
432 .flags = FLAG_WWAN,
433 .bind = cdc_bind,
434 .unbind = usbnet_cdc_unbind,
435 .status = cdc_status,
438 /*-------------------------------------------------------------------------*/
441 static const struct usb_device_id products [] = {
443 * BLACKLIST !!
445 * First blacklist any products that are egregiously nonconformant
446 * with the CDC Ethernet specs. Minor braindamage we cope with; when
447 * they're not even trying, needing a separate driver is only the first
448 * of the differences to show up.
451 #define ZAURUS_MASTER_INTERFACE \
452 .bInterfaceClass = USB_CLASS_COMM, \
453 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
454 .bInterfaceProtocol = USB_CDC_PROTO_NONE
456 /* SA-1100 based Sharp Zaurus ("collie"), or compatible;
457 * wire-incompatible with true CDC Ethernet implementations.
458 * (And, it seems, needlessly so...)
461 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
462 | USB_DEVICE_ID_MATCH_DEVICE,
463 .idVendor = 0x04DD,
464 .idProduct = 0x8004,
465 ZAURUS_MASTER_INTERFACE,
466 .driver_info = 0,
469 /* PXA-25x based Sharp Zaurii. Note that it seems some of these
470 * (later models especially) may have shipped only with firmware
471 * advertising false "CDC MDLM" compatibility ... but we're not
472 * clear which models did that, so for now let's assume the worst.
475 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
476 | USB_DEVICE_ID_MATCH_DEVICE,
477 .idVendor = 0x04DD,
478 .idProduct = 0x8005, /* A-300 */
479 ZAURUS_MASTER_INTERFACE,
480 .driver_info = 0,
481 }, {
482 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
483 | USB_DEVICE_ID_MATCH_DEVICE,
484 .idVendor = 0x04DD,
485 .idProduct = 0x8006, /* B-500/SL-5600 */
486 ZAURUS_MASTER_INTERFACE,
487 .driver_info = 0,
488 }, {
489 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
490 | USB_DEVICE_ID_MATCH_DEVICE,
491 .idVendor = 0x04DD,
492 .idProduct = 0x8007, /* C-700 */
493 ZAURUS_MASTER_INTERFACE,
494 .driver_info = 0,
495 }, {
496 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
497 | USB_DEVICE_ID_MATCH_DEVICE,
498 .idVendor = 0x04DD,
499 .idProduct = 0x9031, /* C-750 C-760 */
500 ZAURUS_MASTER_INTERFACE,
501 .driver_info = 0,
502 }, {
503 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
504 | USB_DEVICE_ID_MATCH_DEVICE,
505 .idVendor = 0x04DD,
506 .idProduct = 0x9032, /* SL-6000 */
507 ZAURUS_MASTER_INTERFACE,
508 .driver_info = 0,
509 }, {
510 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
511 | USB_DEVICE_ID_MATCH_DEVICE,
512 .idVendor = 0x04DD,
513 /* reported with some C860 units */
514 .idProduct = 0x9050, /* C-860 */
515 ZAURUS_MASTER_INTERFACE,
516 .driver_info = 0,
519 /* Olympus has some models with a Zaurus-compatible option.
520 * R-1000 uses a FreeScale i.MXL cpu (ARMv4T)
523 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
524 | USB_DEVICE_ID_MATCH_DEVICE,
525 .idVendor = 0x07B4,
526 .idProduct = 0x0F02, /* R-1000 */
527 ZAURUS_MASTER_INTERFACE,
528 .driver_info = 0,
532 * WHITELIST!!!
534 * CDC Ether uses two interfaces, not necessarily consecutive.
535 * We match the main interface, ignoring the optional device
536 * class so we could handle devices that aren't exclusively
537 * CDC ether.
539 * NOTE: this match must come AFTER entries blacklisting devices
540 * because of bugs/quirks in a given product (like Zaurus, above).
543 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
544 USB_CDC_PROTO_NONE),
545 .driver_info = (unsigned long) &cdc_info,
546 }, {
547 /* Ericsson F3507g */
548 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
549 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
550 .driver_info = (unsigned long) &mbm_info,
551 }, {
552 /* Ericsson F3507g ver. 2 */
553 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1902, USB_CLASS_COMM,
554 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
555 .driver_info = (unsigned long) &mbm_info,
556 }, {
557 /* Ericsson F3607gw */
558 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1904, USB_CLASS_COMM,
559 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
560 .driver_info = (unsigned long) &mbm_info,
561 }, {
562 /* Ericsson F3607gw ver 2 */
563 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1905, USB_CLASS_COMM,
564 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
565 .driver_info = (unsigned long) &mbm_info,
566 }, {
567 /* Ericsson F3607gw ver 3 */
568 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM,
569 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
570 .driver_info = (unsigned long) &mbm_info,
571 }, {
572 /* Ericsson F3307 */
573 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190a, USB_CLASS_COMM,
574 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
575 .driver_info = (unsigned long) &mbm_info,
576 }, {
577 /* Ericsson F3307 ver 2 */
578 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1909, USB_CLASS_COMM,
579 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
580 .driver_info = (unsigned long) &mbm_info,
581 }, {
582 /* Ericsson C3607w */
583 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1049, USB_CLASS_COMM,
584 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
585 .driver_info = (unsigned long) &mbm_info,
586 }, {
587 /* Toshiba F3507g */
588 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
589 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
590 .driver_info = (unsigned long) &mbm_info,
591 }, {
592 /* Toshiba F3607gw */
593 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130c, USB_CLASS_COMM,
594 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
595 .driver_info = (unsigned long) &mbm_info,
596 }, {
597 /* Toshiba F3607gw ver 2 */
598 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x1311, USB_CLASS_COMM,
599 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
600 .driver_info = (unsigned long) &mbm_info,
601 }, {
602 /* Dell F3507g */
603 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM,
604 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
605 .driver_info = (unsigned long) &mbm_info,
606 }, {
607 /* Dell F3607gw */
608 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8183, USB_CLASS_COMM,
609 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
610 .driver_info = (unsigned long) &mbm_info,
611 }, {
612 /* Dell F3607gw ver 2 */
613 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8184, USB_CLASS_COMM,
614 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
615 .driver_info = (unsigned long) &mbm_info,
617 { }, // END
619 MODULE_DEVICE_TABLE(usb, products);
621 static struct usb_driver cdc_driver = {
622 .name = "cdc_ether",
623 .id_table = products,
624 .probe = usbnet_probe,
625 .disconnect = usbnet_disconnect,
626 .suspend = usbnet_suspend,
627 .resume = usbnet_resume,
628 .reset_resume = usbnet_resume,
629 .supports_autosuspend = 1,
633 static int __init cdc_init(void)
635 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
636 < sizeof(struct cdc_state)));
638 return usb_register(&cdc_driver);
640 module_init(cdc_init);
642 static void __exit cdc_exit(void)
644 usb_deregister(&cdc_driver);
646 module_exit(cdc_exit);
648 MODULE_AUTHOR("David Brownell");
649 MODULE_DESCRIPTION("USB CDC Ethernet devices");
650 MODULE_LICENSE("GPL");