Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * zero.c -- Gadget Zero, for USB development |
| 3 | * |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 4 | * Copyright (C) 2003-2008 David Brownell |
| 5 | * Copyright (C) 2008 by Nokia Corporation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * |
David Brownell | ca2bdf4 | 2007-08-02 12:20:05 -0700 | [diff] [blame] | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | * |
David Brownell | ca2bdf4 | 2007-08-02 12:20:05 -0700 | [diff] [blame] | 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | * |
David Brownell | ca2bdf4 | 2007-08-02 12:20:05 -0700 | [diff] [blame] | 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | |
| 23 | /* |
| 24 | * Gadget Zero only needs two bulk endpoints, and is an example of how you |
| 25 | * can write a hardware-agnostic gadget driver running inside a USB device. |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 26 | * Some hardware details are visible, but don't affect most of the driver. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | * |
| 28 | * Use it with the Linux host/master side "usbtest" driver to get a basic |
| 29 | * functional test of your device-side usb stack, or with "usb-skeleton". |
| 30 | * |
| 31 | * It supports two similar configurations. One sinks whatever the usb host |
| 32 | * writes, and in return sources zeroes. The other loops whatever the host |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 33 | * writes back, so the host can read it. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | * |
| 35 | * Many drivers will only have one configuration, letting them be much |
| 36 | * simpler if they also don't support high speed operation (like this |
| 37 | * driver does). |
David Brownell | ca2bdf4 | 2007-08-02 12:20:05 -0700 | [diff] [blame] | 38 | * |
| 39 | * Why is *this* driver using two configurations, rather than setting up |
| 40 | * two interfaces with different functions? To help verify that multiple |
| 41 | * configuration infrastucture is working correctly; also, so that it can |
| 42 | * work with low capability USB controllers without four bulk endpoints. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | */ |
| 44 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 45 | /* |
| 46 | * driver assumes self-powered hardware, and |
| 47 | * has no way for users to trigger remote wakeup. |
| 48 | */ |
| 49 | |
David Brownell | ca2bdf4 | 2007-08-02 12:20:05 -0700 | [diff] [blame] | 50 | /* #define VERBOSE_DEBUG */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #include <linux/utsname.h> |
| 54 | #include <linux/device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 56 | #include "g_zero.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | #include "gadget_chips.h" |
| 58 | |
| 59 | |
| 60 | /*-------------------------------------------------------------------------*/ |
| 61 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 62 | #define DRIVER_VERSION "Cinco de Mayo 2008" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 64 | static const char longname[] = "Gadget Zero"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 66 | unsigned buflen = 4096; |
| 67 | module_param(buflen, uint, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
| 69 | /* |
| 70 | * Normally the "loopback" configuration is second (index 1) so |
| 71 | * it's not the default. Here's where to change that order, to |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 72 | * work better with hosts where config changes are problematic or |
| 73 | * controllers (like original superh) that only support one config. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | */ |
| 75 | static int loopdefault = 0; |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 76 | module_param(loopdefault, bool, S_IRUGO|S_IWUSR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
| 78 | /*-------------------------------------------------------------------------*/ |
| 79 | |
| 80 | /* Thanks to NetChip Technologies for donating this product ID. |
| 81 | * |
| 82 | * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! |
| 83 | * Instead: allocate your own, using normal USB-IF procedures. |
| 84 | */ |
| 85 | #ifndef CONFIG_USB_ZERO_HNPTEST |
| 86 | #define DRIVER_VENDOR_NUM 0x0525 /* NetChip */ |
| 87 | #define DRIVER_PRODUCT_NUM 0xa4a0 /* Linux-USB "Gadget Zero" */ |
| 88 | #else |
| 89 | #define DRIVER_VENDOR_NUM 0x1a0a /* OTG test device IDs */ |
| 90 | #define DRIVER_PRODUCT_NUM 0xbadd |
| 91 | #endif |
| 92 | |
| 93 | /*-------------------------------------------------------------------------*/ |
| 94 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 95 | static struct usb_device_descriptor device_desc = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | .bLength = sizeof device_desc, |
| 97 | .bDescriptorType = USB_DT_DEVICE, |
| 98 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 99 | .bcdUSB = __constant_cpu_to_le16(0x0200), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | .bDeviceClass = USB_CLASS_VENDOR_SPEC, |
| 101 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 102 | .idVendor = __constant_cpu_to_le16(DRIVER_VENDOR_NUM), |
| 103 | .idProduct = __constant_cpu_to_le16(DRIVER_PRODUCT_NUM), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | .bNumConfigurations = 2, |
| 105 | }; |
| 106 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 107 | #ifdef CONFIG_USB_OTG |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 108 | static struct usb_otg_descriptor otg_descriptor = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | .bLength = sizeof otg_descriptor, |
| 110 | .bDescriptorType = USB_DT_OTG, |
| 111 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 112 | /* REVISIT SRP-only hardware is possible, although |
| 113 | * it would not be called "OTG" ... |
| 114 | */ |
| 115 | .bmAttributes = USB_OTG_SRP | USB_OTG_HNP, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | }; |
| 117 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 118 | const struct usb_descriptor_header *otg_desc[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | (struct usb_descriptor_header *) &otg_descriptor, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | NULL, |
| 121 | }; |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 122 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 124 | /* string IDs are assigned dynamically */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 126 | #define STRING_MANUFACTURER_IDX 0 |
| 127 | #define STRING_PRODUCT_IDX 1 |
| 128 | #define STRING_SERIAL_IDX 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | |
David Brownell | ca2bdf4 | 2007-08-02 12:20:05 -0700 | [diff] [blame] | 130 | static char manufacturer[50]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | |
David Brownell | ca2bdf4 | 2007-08-02 12:20:05 -0700 | [diff] [blame] | 132 | /* default serial number takes at least two packets */ |
| 133 | static char serial[] = "0123456789.0123456789.0123456789"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 135 | static struct usb_string strings_dev[] = { |
| 136 | [STRING_MANUFACTURER_IDX].s = manufacturer, |
| 137 | [STRING_PRODUCT_IDX].s = longname, |
| 138 | [STRING_SERIAL_IDX].s = serial, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | { } /* end of list */ |
| 140 | }; |
| 141 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 142 | static struct usb_gadget_strings stringtab_dev = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | .language = 0x0409, /* en-us */ |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 144 | .strings = strings_dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | }; |
| 146 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 147 | static struct usb_gadget_strings *dev_strings[] = { |
| 148 | &stringtab_dev, |
| 149 | NULL, |
| 150 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | |
| 152 | /*-------------------------------------------------------------------------*/ |
| 153 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 154 | struct usb_request *alloc_ep_req(struct usb_ep *ep) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | { |
| 156 | struct usb_request *req; |
| 157 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 158 | req = usb_ep_alloc_request(ep, GFP_ATOMIC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | if (req) { |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 160 | req->length = buflen; |
| 161 | req->buf = kmalloc(buflen, GFP_ATOMIC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | if (!req->buf) { |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 163 | usb_ep_free_request(ep, req); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | req = NULL; |
| 165 | } |
| 166 | } |
| 167 | return req; |
| 168 | } |
| 169 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 170 | void free_ep_req(struct usb_ep *ep, struct usb_request *req) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | { |
David Brownell | 9d8bab5 | 2007-07-01 11:04:54 -0700 | [diff] [blame] | 172 | kfree(req->buf); |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 173 | usb_ep_free_request(ep, req); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | } |
| 175 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 176 | static void disable_ep(struct usb_composite_dev *cdev, struct usb_ep *ep) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | { |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 178 | int value; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 180 | if (ep->driver_data) { |
| 181 | value = usb_ep_disable(ep); |
| 182 | if (value < 0) |
| 183 | DBG(cdev, "disable %s --> %d\n", |
| 184 | ep->name, value); |
| 185 | ep->driver_data = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 189 | void disable_endpoints(struct usb_composite_dev *cdev, |
| 190 | struct usb_ep *in, struct usb_ep *out) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | { |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 192 | disable_ep(cdev, in); |
| 193 | disable_ep(cdev, out); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | /*-------------------------------------------------------------------------*/ |
| 197 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 198 | static int __init zero_bind(struct usb_composite_dev *cdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | { |
David Brownell | 91e79c9 | 2005-07-13 15:18:30 -0700 | [diff] [blame] | 200 | int gcnum; |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 201 | struct usb_gadget *gadget = cdev->gadget; |
| 202 | int id; |
David Brownell | 91e79c9 | 2005-07-13 15:18:30 -0700 | [diff] [blame] | 203 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 204 | /* Allocate string descriptor numbers ... note that string |
| 205 | * contents can be overridden by the composite_dev glue. |
David Brownell | 91e79c9 | 2005-07-13 15:18:30 -0700 | [diff] [blame] | 206 | */ |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 207 | id = usb_string_id(cdev); |
| 208 | if (id < 0) |
| 209 | return id; |
| 210 | strings_dev[STRING_MANUFACTURER_IDX].id = id; |
| 211 | device_desc.iManufacturer = id; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 213 | id = usb_string_id(cdev); |
| 214 | if (id < 0) |
| 215 | return id; |
| 216 | strings_dev[STRING_PRODUCT_IDX].id = id; |
| 217 | device_desc.iProduct = id; |
| 218 | |
| 219 | id = usb_string_id(cdev); |
| 220 | if (id < 0) |
| 221 | return id; |
| 222 | strings_dev[STRING_SERIAL_IDX].id = id; |
| 223 | device_desc.iSerialNumber = id; |
| 224 | |
| 225 | /* Register primary, then secondary configuration. Note that |
| 226 | * SH3 only allows one config... |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | */ |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 228 | if (loopdefault) { |
| 229 | loopback_add(cdev); |
| 230 | if (!gadget_is_sh(gadget)) |
| 231 | sourcesink_add(cdev); |
| 232 | } else { |
| 233 | sourcesink_add(cdev); |
| 234 | if (!gadget_is_sh(gadget)) |
| 235 | loopback_add(cdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 238 | gcnum = usb_gadget_controller_number(gadget); |
David Brownell | 91e79c9 | 2005-07-13 15:18:30 -0700 | [diff] [blame] | 239 | if (gcnum >= 0) |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 240 | device_desc.bcdDevice = cpu_to_le16(0x0200 + gcnum); |
David Brownell | 91e79c9 | 2005-07-13 15:18:30 -0700 | [diff] [blame] | 241 | else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | /* gadget zero is so simple (for now, no altsettings) that |
| 243 | * it SHOULD NOT have problems with bulk-capable hardware. |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 244 | * so just warn about unrcognized controllers -- don't panic. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | * |
| 246 | * things like configuration and altsetting numbering |
| 247 | * can need hardware-specific attention though. |
| 248 | */ |
David Brownell | 0027492 | 2007-11-19 12:58:36 -0800 | [diff] [blame] | 249 | pr_warning("%s: controller '%s' not recognized\n", |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 250 | longname, gadget->name); |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 251 | device_desc.bcdDevice = __constant_cpu_to_le16(0x9999); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 255 | INFO(cdev, "%s, version: " DRIVER_VERSION "\n", longname); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 257 | snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", |
Serge E. Hallyn | 96b644b | 2006-10-02 02:18:13 -0700 | [diff] [blame] | 258 | init_utsname()->sysname, init_utsname()->release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | gadget->name); |
| 260 | |
| 261 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | } |
| 263 | |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 264 | static struct usb_composite_driver zero_driver = { |
| 265 | .name = "zero", |
| 266 | .dev = &device_desc, |
| 267 | .strings = dev_strings, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | .bind = zero_bind, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | }; |
| 270 | |
David Brownell | ca2bdf4 | 2007-08-02 12:20:05 -0700 | [diff] [blame] | 271 | MODULE_AUTHOR("David Brownell"); |
| 272 | MODULE_LICENSE("GPL"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 274 | static int __init init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | { |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 276 | return usb_composite_register(&zero_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | } |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 278 | module_init(init); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 280 | static void __exit cleanup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | { |
David Brownell | 097db1d | 2008-06-19 18:18:27 -0700 | [diff] [blame] | 282 | usb_composite_unregister(&zero_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | } |
David Brownell | 7472f38 | 2008-04-18 18:47:54 -0700 | [diff] [blame] | 284 | module_exit(cleanup); |