Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * USB ZyXEL omni.net LCD PLUS driver |
| 3 | * |
Greg Kroah-Hartman | 4d0dce3 | 2007-06-12 11:43:37 -0700 | [diff] [blame] | 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License version |
| 6 | * 2 as published by the Free Software Foundation. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * |
| 8 | * See Documentation/usb/usb-serial.txt for more information on using this driver |
| 9 | * |
| 10 | * Please report both successes and troubles to the author at omninet@kroah.com |
| 11 | * |
| 12 | * (05/30/2001) gkh |
| 13 | * switched from using spinlock to a semaphore, which fixes lots of problems. |
| 14 | * |
| 15 | * (04/08/2001) gb |
| 16 | * Identify version on module load. |
| 17 | * |
| 18 | * (11/01/2000) Adam J. Richter |
| 19 | * usb_device_id table support |
| 20 | * |
| 21 | * (10/05/2000) gkh |
| 22 | * Fixed bug with urb->dev not being set properly, now that the usb |
| 23 | * core needs it. |
| 24 | * |
| 25 | * (08/28/2000) gkh |
| 26 | * Added locks for SMP safeness. |
| 27 | * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more |
| 28 | * than once. |
| 29 | * Fixed potential race in omninet_write_bulk_callback |
| 30 | * |
| 31 | * (07/19/2000) gkh |
| 32 | * Added module_init and module_exit functions to handle the fact that this |
| 33 | * driver is a loadable module now. |
| 34 | * |
| 35 | */ |
| 36 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #include <linux/kernel.h> |
| 38 | #include <linux/errno.h> |
| 39 | #include <linux/init.h> |
| 40 | #include <linux/slab.h> |
| 41 | #include <linux/tty.h> |
| 42 | #include <linux/tty_driver.h> |
| 43 | #include <linux/tty_flip.h> |
| 44 | #include <linux/module.h> |
| 45 | #include <linux/spinlock.h> |
| 46 | #include <asm/uaccess.h> |
| 47 | #include <linux/usb.h> |
Greg Kroah-Hartman | a969888 | 2006-07-11 21:22:58 -0700 | [diff] [blame] | 48 | #include <linux/usb/serial.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | static int debug; |
| 51 | |
| 52 | /* |
| 53 | * Version Information |
| 54 | */ |
| 55 | #define DRIVER_VERSION "v1.1" |
| 56 | #define DRIVER_AUTHOR "Alessandro Zummo" |
| 57 | #define DRIVER_DESC "USB ZyXEL omni.net LCD PLUS Driver" |
| 58 | |
| 59 | #define ZYXEL_VENDOR_ID 0x0586 |
| 60 | #define ZYXEL_OMNINET_ID 0x1000 |
| 61 | #define BT_IGNITIONPRO_ID 0x2000 /* This one seems to be a re-branded ZyXEL device */ |
| 62 | |
| 63 | /* function prototypes */ |
| 64 | static int omninet_open (struct usb_serial_port *port, struct file *filp); |
| 65 | static void omninet_close (struct usb_serial_port *port, struct file *filp); |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 66 | static void omninet_read_bulk_callback (struct urb *urb); |
| 67 | static void omninet_write_bulk_callback (struct urb *urb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | static int omninet_write (struct usb_serial_port *port, const unsigned char *buf, int count); |
| 69 | static int omninet_write_room (struct usb_serial_port *port); |
| 70 | static void omninet_shutdown (struct usb_serial *serial); |
Oliver Neukum | 5ec1862 | 2007-03-27 16:02:34 +0200 | [diff] [blame] | 71 | static int omninet_attach (struct usb_serial *serial); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | |
| 73 | static struct usb_device_id id_table [] = { |
| 74 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, |
| 75 | { USB_DEVICE(ZYXEL_VENDOR_ID, BT_IGNITIONPRO_ID) }, |
| 76 | { } /* Terminating entry */ |
| 77 | }; |
| 78 | |
| 79 | MODULE_DEVICE_TABLE (usb, id_table); |
| 80 | |
| 81 | static struct usb_driver omninet_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | .name = "omninet", |
| 83 | .probe = usb_serial_probe, |
| 84 | .disconnect = usb_serial_disconnect, |
| 85 | .id_table = id_table, |
Greg Kroah-Hartman | ba9dc65 | 2005-11-16 13:41:28 -0800 | [diff] [blame] | 86 | .no_dynamic_id = 1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | |
Greg Kroah-Hartman | ea65370 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 90 | static struct usb_serial_driver zyxel_omninet_device = { |
Greg Kroah-Hartman | 18fcac3 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 91 | .driver = { |
| 92 | .owner = THIS_MODULE, |
Greg Kroah-Hartman | 269bda1 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 93 | .name = "omninet", |
Greg Kroah-Hartman | 18fcac3 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 94 | }, |
Greg Kroah-Hartman | 269bda1 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 95 | .description = "ZyXEL - omni.net lcd plus usb", |
Johannes Hölzl | d9b1b78 | 2006-12-17 21:50:24 +0100 | [diff] [blame] | 96 | .usb_driver = &omninet_driver, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | .id_table = id_table, |
| 98 | .num_interrupt_in = 1, |
| 99 | .num_bulk_in = 1, |
| 100 | .num_bulk_out = 2, |
| 101 | .num_ports = 1, |
Oliver Neukum | 5ec1862 | 2007-03-27 16:02:34 +0200 | [diff] [blame] | 102 | .attach = omninet_attach, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | .open = omninet_open, |
| 104 | .close = omninet_close, |
| 105 | .write = omninet_write, |
| 106 | .write_room = omninet_write_room, |
| 107 | .read_bulk_callback = omninet_read_bulk_callback, |
| 108 | .write_bulk_callback = omninet_write_bulk_callback, |
| 109 | .shutdown = omninet_shutdown, |
| 110 | }; |
| 111 | |
| 112 | |
| 113 | /* The protocol. |
| 114 | * |
| 115 | * The omni.net always exchange 64 bytes of data with the host. The first |
| 116 | * four bytes are the control header, you can see it in the above structure. |
| 117 | * |
| 118 | * oh_seq is a sequence number. Don't know if/how it's used. |
| 119 | * oh_len is the length of the data bytes in the packet. |
| 120 | * oh_xxx Bit-mapped, related to handshaking and status info. |
| 121 | * I normally set it to 0x03 in trasmitted frames. |
| 122 | * 7: Active when the TA is in a CONNECTed state. |
| 123 | * 6: unknown |
| 124 | * 5: handshaking, unknown |
| 125 | * 4: handshaking, unknown |
| 126 | * 3: unknown, usually 0 |
| 127 | * 2: unknown, usually 0 |
| 128 | * 1: handshaking, unknown, usually set to 1 in trasmitted frames |
| 129 | * 0: handshaking, unknown, usually set to 1 in trasmitted frames |
| 130 | * oh_pad Probably a pad byte. |
| 131 | * |
| 132 | * After the header you will find data bytes if oh_len was greater than zero. |
| 133 | * |
| 134 | */ |
| 135 | |
| 136 | struct omninet_header |
| 137 | { |
| 138 | __u8 oh_seq; |
| 139 | __u8 oh_len; |
| 140 | __u8 oh_xxx; |
| 141 | __u8 oh_pad; |
| 142 | }; |
| 143 | |
| 144 | struct omninet_data |
| 145 | { |
| 146 | __u8 od_outseq; // Sequence number for bulk_out URBs |
| 147 | }; |
| 148 | |
Oliver Neukum | 5ec1862 | 2007-03-27 16:02:34 +0200 | [diff] [blame] | 149 | static int omninet_attach (struct usb_serial *serial) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | { |
Oliver Neukum | 5ec1862 | 2007-03-27 16:02:34 +0200 | [diff] [blame] | 151 | struct omninet_data *od; |
| 152 | struct usb_serial_port *port = serial->port[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | |
| 154 | od = kmalloc( sizeof(struct omninet_data), GFP_KERNEL ); |
| 155 | if( !od ) { |
| 156 | err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct omninet_data)); |
| 157 | return -ENOMEM; |
| 158 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | usb_set_serial_port_data(port, od); |
Oliver Neukum | 5ec1862 | 2007-03-27 16:02:34 +0200 | [diff] [blame] | 160 | return 0; |
| 161 | } |
| 162 | |
| 163 | static int omninet_open (struct usb_serial_port *port, struct file *filp) |
| 164 | { |
| 165 | struct usb_serial *serial = port->serial; |
| 166 | struct usb_serial_port *wport; |
Oliver Neukum | 5ec1862 | 2007-03-27 16:02:34 +0200 | [diff] [blame] | 167 | int result = 0; |
| 168 | |
| 169 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 170 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | wport = serial->port[1]; |
| 172 | wport->tty = port->tty; |
| 173 | |
| 174 | /* Start reading from the device */ |
| 175 | usb_fill_bulk_urb(port->read_urb, serial->dev, |
| 176 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), |
| 177 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, |
| 178 | omninet_read_bulk_callback, port); |
| 179 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); |
Oliver Neukum | 4f93b3e | 2007-03-20 13:15:05 +0100 | [diff] [blame] | 180 | if (result) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); |
Oliver Neukum | 4f93b3e | 2007-03-20 13:15:05 +0100 | [diff] [blame] | 182 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | |
| 184 | return result; |
| 185 | } |
| 186 | |
| 187 | static void omninet_close (struct usb_serial_port *port, struct file * filp) |
| 188 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | dbg("%s - port %d", __FUNCTION__, port->number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | usb_kill_urb(port->read_urb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | |
| 194 | #define OMNINET_DATAOFFSET 0x04 |
| 195 | #define OMNINET_HEADERLEN sizeof(struct omninet_header) |
| 196 | #define OMNINET_BULKOUTSIZE (64 - OMNINET_HEADERLEN) |
| 197 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 198 | static void omninet_read_bulk_callback (struct urb *urb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | { |
| 200 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
| 201 | unsigned char *data = urb->transfer_buffer; |
| 202 | struct omninet_header *header = (struct omninet_header *) &data[0]; |
Greg Kroah-Hartman | fdc2deb | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 203 | int status = urb->status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | int i; |
| 205 | int result; |
| 206 | |
Greg Kroah-Hartman | 71a8924 | 2006-03-20 17:28:39 -0500 | [diff] [blame] | 207 | dbg("%s - port %d", __FUNCTION__, port->number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | |
Greg Kroah-Hartman | fdc2deb | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 209 | if (status) { |
| 210 | dbg("%s - nonzero read bulk status received: %d", |
| 211 | __FUNCTION__, status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | return; |
| 213 | } |
| 214 | |
| 215 | if ((debug) && (header->oh_xxx != 0x30)) { |
| 216 | if (urb->actual_length) { |
| 217 | printk (KERN_DEBUG __FILE__ ": omninet_read %d: ", header->oh_len); |
| 218 | for (i = 0; i < (header->oh_len + OMNINET_HEADERLEN); i++) { |
| 219 | printk ("%.2x ", data[i]); |
| 220 | } |
| 221 | printk ("\n"); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | if (urb->actual_length && header->oh_len) { |
| 226 | for (i = 0; i < header->oh_len; i++) { |
| 227 | tty_insert_flip_char(port->tty, data[OMNINET_DATAOFFSET + i], 0); |
| 228 | } |
| 229 | tty_flip_buffer_push(port->tty); |
| 230 | } |
| 231 | |
| 232 | /* Continue trying to always read */ |
| 233 | usb_fill_bulk_urb(urb, port->serial->dev, |
| 234 | usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), |
| 235 | urb->transfer_buffer, urb->transfer_buffer_length, |
| 236 | omninet_read_bulk_callback, port); |
| 237 | result = usb_submit_urb(urb, GFP_ATOMIC); |
| 238 | if (result) |
| 239 | err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); |
| 240 | |
| 241 | return; |
| 242 | } |
| 243 | |
| 244 | static int omninet_write (struct usb_serial_port *port, const unsigned char *buf, int count) |
| 245 | { |
| 246 | struct usb_serial *serial = port->serial; |
| 247 | struct usb_serial_port *wport = serial->port[1]; |
| 248 | |
| 249 | struct omninet_data *od = usb_get_serial_port_data(port); |
| 250 | struct omninet_header *header = (struct omninet_header *) wport->write_urb->transfer_buffer; |
| 251 | |
| 252 | int result; |
| 253 | |
Greg Kroah-Hartman | 71a8924 | 2006-03-20 17:28:39 -0500 | [diff] [blame] | 254 | dbg("%s - port %d", __FUNCTION__, port->number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | |
| 256 | if (count == 0) { |
| 257 | dbg("%s - write request of 0 bytes", __FUNCTION__); |
| 258 | return (0); |
| 259 | } |
Greg Kroah-Hartman | 507ca9b | 2005-04-23 12:49:16 -0700 | [diff] [blame] | 260 | |
Peter Zijlstra | e81ee63 | 2006-09-25 12:51:41 +0200 | [diff] [blame] | 261 | spin_lock_bh(&wport->lock); |
Greg Kroah-Hartman | df3fccb | 2006-05-02 08:44:45 +0200 | [diff] [blame] | 262 | if (wport->write_urb_busy) { |
Peter Zijlstra | e81ee63 | 2006-09-25 12:51:41 +0200 | [diff] [blame] | 263 | spin_unlock_bh(&wport->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | dbg("%s - already writing", __FUNCTION__); |
Greg Kroah-Hartman | 507ca9b | 2005-04-23 12:49:16 -0700 | [diff] [blame] | 265 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | } |
Greg Kroah-Hartman | df3fccb | 2006-05-02 08:44:45 +0200 | [diff] [blame] | 267 | wport->write_urb_busy = 1; |
Peter Zijlstra | e81ee63 | 2006-09-25 12:51:41 +0200 | [diff] [blame] | 268 | spin_unlock_bh(&wport->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | |
| 270 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; |
| 271 | |
| 272 | memcpy (wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count); |
| 273 | |
| 274 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, wport->write_urb->transfer_buffer); |
| 275 | |
| 276 | header->oh_seq = od->od_outseq++; |
| 277 | header->oh_len = count; |
| 278 | header->oh_xxx = 0x03; |
| 279 | header->oh_pad = 0x00; |
| 280 | |
| 281 | /* send the data out the bulk port, always 64 bytes */ |
| 282 | wport->write_urb->transfer_buffer_length = 64; |
| 283 | |
| 284 | wport->write_urb->dev = serial->dev; |
| 285 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); |
Greg Kroah-Hartman | 507ca9b | 2005-04-23 12:49:16 -0700 | [diff] [blame] | 286 | if (result) { |
Greg Kroah-Hartman | df3fccb | 2006-05-02 08:44:45 +0200 | [diff] [blame] | 287 | wport->write_urb_busy = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); |
Greg Kroah-Hartman | 507ca9b | 2005-04-23 12:49:16 -0700 | [diff] [blame] | 289 | } else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | result = count; |
| 291 | |
| 292 | return result; |
| 293 | } |
| 294 | |
| 295 | |
| 296 | static int omninet_write_room (struct usb_serial_port *port) |
| 297 | { |
| 298 | struct usb_serial *serial = port->serial; |
| 299 | struct usb_serial_port *wport = serial->port[1]; |
| 300 | |
| 301 | int room = 0; // Default: no room |
| 302 | |
Greg Kroah-Hartman | 507ca9b | 2005-04-23 12:49:16 -0700 | [diff] [blame] | 303 | if (wport->write_urb_busy) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | room = wport->bulk_out_size - OMNINET_HEADERLEN; |
| 305 | |
Greg Kroah-Hartman | 71a8924 | 2006-03-20 17:28:39 -0500 | [diff] [blame] | 306 | dbg("%s - returns %d", __FUNCTION__, room); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | |
| 308 | return (room); |
| 309 | } |
| 310 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 311 | static void omninet_write_bulk_callback (struct urb *urb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | { |
| 313 | /* struct omninet_header *header = (struct omninet_header *) urb->transfer_buffer; */ |
| 314 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; |
Greg Kroah-Hartman | fdc2deb | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 315 | int status = urb->status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | |
Greg Kroah-Hartman | 71a8924 | 2006-03-20 17:28:39 -0500 | [diff] [blame] | 317 | dbg("%s - port %0x\n", __FUNCTION__, port->number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | |
Greg Kroah-Hartman | 507ca9b | 2005-04-23 12:49:16 -0700 | [diff] [blame] | 319 | port->write_urb_busy = 0; |
Greg Kroah-Hartman | fdc2deb | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 320 | if (status) { |
| 321 | dbg("%s - nonzero write bulk status received: %d", |
| 322 | __FUNCTION__, status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | return; |
| 324 | } |
| 325 | |
Pete Zaitcev | cf2c748 | 2006-05-22 21:58:49 -0700 | [diff] [blame] | 326 | usb_serial_port_softint(port); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | |
| 330 | static void omninet_shutdown (struct usb_serial *serial) |
| 331 | { |
Oliver Neukum | 5ec1862 | 2007-03-27 16:02:34 +0200 | [diff] [blame] | 332 | struct usb_serial_port *wport = serial->port[1]; |
| 333 | struct usb_serial_port *port = serial->port[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | dbg ("%s", __FUNCTION__); |
Oliver Neukum | 5ec1862 | 2007-03-27 16:02:34 +0200 | [diff] [blame] | 335 | |
| 336 | usb_kill_urb(wport->write_urb); |
| 337 | kfree(usb_get_serial_port_data(port)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | |
| 341 | static int __init omninet_init (void) |
| 342 | { |
| 343 | int retval; |
| 344 | retval = usb_serial_register(&zyxel_omninet_device); |
| 345 | if (retval) |
| 346 | goto failed_usb_serial_register; |
| 347 | retval = usb_register(&omninet_driver); |
| 348 | if (retval) |
| 349 | goto failed_usb_register; |
| 350 | info(DRIVER_VERSION ":" DRIVER_DESC); |
| 351 | return 0; |
| 352 | failed_usb_register: |
| 353 | usb_serial_deregister(&zyxel_omninet_device); |
| 354 | failed_usb_serial_register: |
| 355 | return retval; |
| 356 | } |
| 357 | |
| 358 | |
| 359 | static void __exit omninet_exit (void) |
| 360 | { |
| 361 | usb_deregister (&omninet_driver); |
| 362 | usb_serial_deregister (&zyxel_omninet_device); |
| 363 | } |
| 364 | |
| 365 | |
| 366 | module_init(omninet_init); |
| 367 | module_exit(omninet_exit); |
| 368 | |
| 369 | MODULE_AUTHOR( DRIVER_AUTHOR ); |
| 370 | MODULE_DESCRIPTION( DRIVER_DESC ); |
| 371 | MODULE_LICENSE("GPL"); |
| 372 | |
| 373 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
| 374 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |