Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
David Brownell | a7707ad | 2008-06-19 17:52:07 -0700 | [diff] [blame] | 2 | * serial.c -- USB gadget serial driver |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
David Brownell | a7707ad | 2008-06-19 17:52:07 -0700 | [diff] [blame] | 4 | * Copyright (C) 2003 Al Borchers (alborchers@steinerpoint.com) |
| 5 | * Copyright (C) 2008 by David Brownell |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 6 | * Copyright (C) 2008 by Nokia Corporation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * |
| 8 | * This software is distributed under the terms of the GNU General |
| 9 | * Public License ("GPL") as published by the Free Software Foundation, |
| 10 | * either version 2 of that License or (at your option) any later version. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/device.h> |
| 15 | #include <linux/tty.h> |
| 16 | #include <linux/tty_flip.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
David Brownell | a7707ad | 2008-06-19 17:52:07 -0700 | [diff] [blame] | 18 | #include "u_serial.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include "gadget_chips.h" |
| 20 | |
| 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | /* Defines */ |
| 23 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 24 | #define GS_VERSION_STR "v2.4" |
| 25 | #define GS_VERSION_NUM 0x2400 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | |
| 27 | #define GS_LONG_NAME "Gadget Serial" |
David Brownell | a7707ad | 2008-06-19 17:52:07 -0700 | [diff] [blame] | 28 | #define GS_VERSION_NAME GS_LONG_NAME " " GS_VERSION_STR |
| 29 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 30 | /*-------------------------------------------------------------------------*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
David Brownell | 4e9ba51 | 2008-08-18 17:41:02 -0700 | [diff] [blame] | 32 | /* |
| 33 | * Kbuild is not very cooperative with respect to linking separately |
| 34 | * compiled library objects into one module. So for now we won't use |
| 35 | * separate compilation ... ensuring init/exit sections work to shrink |
| 36 | * the runtime footprint, and giving us at least some parts of what |
| 37 | * a "gcc --combine ... part1.c part2.c part3.c ... " build would. |
| 38 | */ |
| 39 | #include "composite.c" |
David Brownell | 4e9ba51 | 2008-08-18 17:41:02 -0700 | [diff] [blame] | 40 | |
| 41 | #include "f_acm.c" |
Felipe Balbi | 3086775 | 2008-08-18 17:39:30 -0700 | [diff] [blame] | 42 | #include "f_obex.c" |
David Brownell | 4e9ba51 | 2008-08-18 17:41:02 -0700 | [diff] [blame] | 43 | #include "f_serial.c" |
| 44 | #include "u_serial.c" |
| 45 | |
| 46 | /*-------------------------------------------------------------------------*/ |
Sebastian Andrzej Siewior | 7d16e8d | 2012-09-10 15:01:53 +0200 | [diff] [blame] | 47 | USB_GADGET_COMPOSITE_OPTIONS(); |
David Brownell | 4e9ba51 | 2008-08-18 17:41:02 -0700 | [diff] [blame] | 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | /* Thanks to NetChip Technologies for donating this product ID. |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 50 | * |
| 51 | * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! |
| 52 | * Instead: allocate your own, using normal USB-IF procedures. |
| 53 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | #define GS_VENDOR_ID 0x0525 /* NetChip */ |
| 55 | #define GS_PRODUCT_ID 0xa4a6 /* Linux-USB Serial Gadget */ |
| 56 | #define GS_CDC_PRODUCT_ID 0xa4a7 /* ... as CDC-ACM */ |
Felipe Balbi | 3086775 | 2008-08-18 17:39:30 -0700 | [diff] [blame] | 57 | #define GS_CDC_OBEX_PRODUCT_ID 0xa4a9 /* ... as CDC-OBEX */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 59 | /* string IDs are assigned dynamically */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Sebastian Andrzej Siewior | 276e2e4 | 2012-09-06 20:11:21 +0200 | [diff] [blame] | 61 | #define STRING_DESCRIPTION_IDX USB_GADGET_FIRST_AVAIL_IDX |
David Brownell | a7707ad | 2008-06-19 17:52:07 -0700 | [diff] [blame] | 62 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 63 | static struct usb_string strings_dev[] = { |
Sebastian Andrzej Siewior | cc2683c | 2012-09-10 15:01:58 +0200 | [diff] [blame^] | 64 | [USB_GADGET_MANUFACTURER_IDX].s = "", |
Sebastian Andrzej Siewior | 276e2e4 | 2012-09-06 20:11:21 +0200 | [diff] [blame] | 65 | [USB_GADGET_PRODUCT_IDX].s = GS_VERSION_NAME, |
| 66 | [USB_GADGET_SERIAL_IDX].s = "", |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 67 | [STRING_DESCRIPTION_IDX].s = NULL /* updated; f(use_acm) */, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | { } /* end of list */ |
| 69 | }; |
| 70 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 71 | static struct usb_gadget_strings stringtab_dev = { |
| 72 | .language = 0x0409, /* en-us */ |
| 73 | .strings = strings_dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 76 | static struct usb_gadget_strings *dev_strings[] = { |
| 77 | &stringtab_dev, |
| 78 | NULL, |
| 79 | }; |
| 80 | |
| 81 | static struct usb_device_descriptor device_desc = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | .bLength = USB_DT_DEVICE_SIZE, |
| 83 | .bDescriptorType = USB_DT_DEVICE, |
Harvey Harrison | 551509d | 2009-02-11 14:11:36 -0800 | [diff] [blame] | 84 | .bcdUSB = cpu_to_le16(0x0200), |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 85 | /* .bDeviceClass = f(use_acm) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | .bDeviceSubClass = 0, |
| 87 | .bDeviceProtocol = 0, |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 88 | /* .bMaxPacketSize0 = f(hardware) */ |
Harvey Harrison | 551509d | 2009-02-11 14:11:36 -0800 | [diff] [blame] | 89 | .idVendor = cpu_to_le16(GS_VENDOR_ID), |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 90 | /* .idProduct = f(use_acm) */ |
| 91 | /* .bcdDevice = f(hardware) */ |
| 92 | /* .iManufacturer = DYNAMIC */ |
| 93 | /* .iProduct = DYNAMIC */ |
| 94 | .bNumConfigurations = 1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | }; |
| 96 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 97 | static struct usb_otg_descriptor otg_descriptor = { |
| 98 | .bLength = sizeof otg_descriptor, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | .bDescriptorType = USB_DT_OTG, |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 100 | |
| 101 | /* REVISIT SRP-only hardware is possible, although |
| 102 | * it would not be called "OTG" ... |
| 103 | */ |
| 104 | .bmAttributes = USB_OTG_SRP | USB_OTG_HNP, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | }; |
| 106 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 107 | static const struct usb_descriptor_header *otg_desc[] = { |
| 108 | (struct usb_descriptor_header *) &otg_descriptor, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | NULL, |
| 110 | }; |
| 111 | |
David Brownell | 9079e91 | 2008-05-07 16:00:36 -0700 | [diff] [blame] | 112 | /*-------------------------------------------------------------------------*/ |
| 113 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | /* Module */ |
David Brownell | a7707ad | 2008-06-19 17:52:07 -0700 | [diff] [blame] | 115 | MODULE_DESCRIPTION(GS_VERSION_NAME); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | MODULE_AUTHOR("Al Borchers"); |
David Brownell | a7707ad | 2008-06-19 17:52:07 -0700 | [diff] [blame] | 117 | MODULE_AUTHOR("David Brownell"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | MODULE_LICENSE("GPL"); |
| 119 | |
Rusty Russell | 90ab5ee | 2012-01-13 09:32:20 +1030 | [diff] [blame] | 120 | static bool use_acm = true; |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 121 | module_param(use_acm, bool, 0); |
| 122 | MODULE_PARM_DESC(use_acm, "Use CDC ACM, default=yes"); |
| 123 | |
Rusty Russell | 90ab5ee | 2012-01-13 09:32:20 +1030 | [diff] [blame] | 124 | static bool use_obex = false; |
Felipe Balbi | 3086775 | 2008-08-18 17:39:30 -0700 | [diff] [blame] | 125 | module_param(use_obex, bool, 0); |
| 126 | MODULE_PARM_DESC(use_obex, "Use CDC OBEX, default=no"); |
| 127 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 128 | static unsigned n_ports = 1; |
| 129 | module_param(n_ports, uint, 0); |
| 130 | MODULE_PARM_DESC(n_ports, "number of ports to create, default=1"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | |
David Brownell | 9079e91 | 2008-05-07 16:00:36 -0700 | [diff] [blame] | 132 | /*-------------------------------------------------------------------------*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | |
Michal Nazarewicz | e12995e | 2010-08-12 17:43:52 +0200 | [diff] [blame] | 134 | static int __init serial_bind_config(struct usb_configuration *c) |
David Brownell | 9079e91 | 2008-05-07 16:00:36 -0700 | [diff] [blame] | 135 | { |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 136 | unsigned i; |
| 137 | int status = 0; |
David Brownell | 9079e91 | 2008-05-07 16:00:36 -0700 | [diff] [blame] | 138 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 139 | for (i = 0; i < n_ports && status == 0; i++) { |
| 140 | if (use_acm) |
| 141 | status = acm_bind_config(c, i); |
Felipe Balbi | 3086775 | 2008-08-18 17:39:30 -0700 | [diff] [blame] | 142 | else if (use_obex) |
| 143 | status = obex_bind_config(c, i); |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 144 | else |
| 145 | status = gser_bind_config(c, i); |
David Brownell | 9079e91 | 2008-05-07 16:00:36 -0700 | [diff] [blame] | 146 | } |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 147 | return status; |
David Brownell | 9079e91 | 2008-05-07 16:00:36 -0700 | [diff] [blame] | 148 | } |
| 149 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 150 | static struct usb_configuration serial_config_driver = { |
| 151 | /* .label = f(use_acm) */ |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 152 | /* .bConfigurationValue = f(use_acm) */ |
| 153 | /* .iConfiguration = DYNAMIC */ |
| 154 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
David Brownell | 9079e91 | 2008-05-07 16:00:36 -0700 | [diff] [blame] | 155 | }; |
| 156 | |
Michal Nazarewicz | e12995e | 2010-08-12 17:43:52 +0200 | [diff] [blame] | 157 | static int __init gs_bind(struct usb_composite_dev *cdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | { |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 159 | int gcnum; |
| 160 | struct usb_gadget *gadget = cdev->gadget; |
| 161 | int status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 163 | status = gserial_setup(cdev->gadget, n_ports); |
| 164 | if (status < 0) |
| 165 | return status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 167 | /* Allocate string descriptor numbers ... note that string |
| 168 | * contents can be overridden by the composite_dev glue. |
David Brownell | f371e75 | 2008-04-18 17:37:49 -0700 | [diff] [blame] | 169 | */ |
| 170 | |
Sebastian Andrzej Siewior | e1f15cc | 2012-09-06 20:11:16 +0200 | [diff] [blame] | 171 | status = usb_string_ids_tab(cdev, strings_dev); |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 172 | if (status < 0) |
| 173 | goto fail; |
Sebastian Andrzej Siewior | 276e2e4 | 2012-09-06 20:11:21 +0200 | [diff] [blame] | 174 | device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id; |
| 175 | device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; |
Sebastian Andrzej Siewior | e1f15cc | 2012-09-06 20:11:16 +0200 | [diff] [blame] | 176 | status = strings_dev[STRING_DESCRIPTION_IDX].id; |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 177 | serial_config_driver.iConfiguration = status; |
| 178 | |
| 179 | /* set up other descriptors */ |
| 180 | gcnum = usb_gadget_controller_number(gadget); |
| 181 | if (gcnum >= 0) |
| 182 | device_desc.bcdDevice = cpu_to_le16(GS_VERSION_NUM | gcnum); |
| 183 | else { |
| 184 | /* this is so simple (for now, no altsettings) that it |
| 185 | * SHOULD NOT have problems with bulk-capable hardware. |
| 186 | * so warn about unrcognized controllers -- don't panic. |
| 187 | * |
| 188 | * things like configuration and altsetting numbering |
| 189 | * can need hardware-specific attention though. |
| 190 | */ |
| 191 | pr_warning("gs_bind: controller '%s' not recognized\n", |
| 192 | gadget->name); |
| 193 | device_desc.bcdDevice = |
Harvey Harrison | 551509d | 2009-02-11 14:11:36 -0800 | [diff] [blame] | 194 | cpu_to_le16(GS_VERSION_NUM | 0x0099); |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | if (gadget_is_otg(cdev->gadget)) { |
| 198 | serial_config_driver.descriptors = otg_desc; |
| 199 | serial_config_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
| 200 | } |
| 201 | |
| 202 | /* register our configuration */ |
Uwe Kleine-König | c9bfff9 | 2010-08-12 17:43:55 +0200 | [diff] [blame] | 203 | status = usb_add_config(cdev, &serial_config_driver, |
| 204 | serial_bind_config); |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 205 | if (status < 0) |
| 206 | goto fail; |
| 207 | |
Sebastian Andrzej Siewior | 7d16e8d | 2012-09-10 15:01:53 +0200 | [diff] [blame] | 208 | usb_composite_overwrite_options(cdev, &coverwrite); |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 209 | INFO(cdev, "%s\n", GS_VERSION_NAME); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | |
| 211 | return 0; |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 212 | |
| 213 | fail: |
| 214 | gserial_cleanup(); |
| 215 | return status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | } |
| 217 | |
Sebastian Andrzej Siewior | c2ec75c | 2012-09-06 20:11:03 +0200 | [diff] [blame] | 218 | static __refdata struct usb_composite_driver gserial_driver = { |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 219 | .name = "g_serial", |
| 220 | .dev = &device_desc, |
| 221 | .strings = dev_strings, |
Sebastian Andrzej Siewior | 6fecfb0 | 2012-02-06 18:46:36 +0100 | [diff] [blame] | 222 | .max_speed = USB_SPEED_SUPER, |
Sebastian Andrzej Siewior | 03e42bd | 2012-09-06 20:11:04 +0200 | [diff] [blame] | 223 | .bind = gs_bind, |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 224 | }; |
| 225 | |
| 226 | static int __init init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | { |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 228 | /* We *could* export two configs; that'd be much cleaner... |
| 229 | * but neither of these product IDs was defined that way. |
| 230 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | if (use_acm) { |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 232 | serial_config_driver.label = "CDC ACM config"; |
| 233 | serial_config_driver.bConfigurationValue = 2; |
| 234 | device_desc.bDeviceClass = USB_CLASS_COMM; |
| 235 | device_desc.idProduct = |
Harvey Harrison | 551509d | 2009-02-11 14:11:36 -0800 | [diff] [blame] | 236 | cpu_to_le16(GS_CDC_PRODUCT_ID); |
Felipe Balbi | 3086775 | 2008-08-18 17:39:30 -0700 | [diff] [blame] | 237 | } else if (use_obex) { |
| 238 | serial_config_driver.label = "CDC OBEX config"; |
| 239 | serial_config_driver.bConfigurationValue = 3; |
| 240 | device_desc.bDeviceClass = USB_CLASS_COMM; |
| 241 | device_desc.idProduct = |
Harvey Harrison | 551509d | 2009-02-11 14:11:36 -0800 | [diff] [blame] | 242 | cpu_to_le16(GS_CDC_OBEX_PRODUCT_ID); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | } else { |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 244 | serial_config_driver.label = "Generic Serial config"; |
| 245 | serial_config_driver.bConfigurationValue = 1; |
| 246 | device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC; |
| 247 | device_desc.idProduct = |
Harvey Harrison | 551509d | 2009-02-11 14:11:36 -0800 | [diff] [blame] | 248 | cpu_to_le16(GS_PRODUCT_ID); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | } |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 250 | strings_dev[STRING_DESCRIPTION_IDX].s = serial_config_driver.label; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | |
Sebastian Andrzej Siewior | 03e42bd | 2012-09-06 20:11:04 +0200 | [diff] [blame] | 252 | return usb_composite_probe(&gserial_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | } |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 254 | module_init(init); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 256 | static void __exit cleanup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | { |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 258 | usb_composite_unregister(&gserial_driver); |
| 259 | gserial_cleanup(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | } |
David Brownell | 7bb5ea5 | 2008-06-19 18:19:03 -0700 | [diff] [blame] | 261 | module_exit(cleanup); |