blob: 46827373ecf936f4a6342e31e5bf3e62ac9dd073 [file] [log] [blame]
Oliver Neukumafba9372008-05-13 17:01:25 +02001/*
2 * cdc-wdm.c
3 *
4 * This driver supports USB CDC WCM Device Management.
5 *
Oliver Neukum052fbc02009-04-20 17:24:49 +02006 * Copyright (c) 2007-2009 Oliver Neukum
Oliver Neukumafba9372008-05-13 17:01:25 +02007 *
8 * Some code taken from cdc-acm.c
9 *
10 * Released under the GPLv2.
11 *
12 * Many thanks to Carl Nordbeck
13 */
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/slab.h>
17#include <linux/module.h>
Oliver Neukumafba9372008-05-13 17:01:25 +020018#include <linux/mutex.h>
19#include <linux/uaccess.h>
20#include <linux/bitops.h>
21#include <linux/poll.h>
22#include <linux/usb.h>
23#include <linux/usb/cdc.h>
24#include <asm/byteorder.h>
25#include <asm/unaligned.h>
26
27/*
28 * Version Information
29 */
Oliver Neukum87d65e52008-06-19 14:20:18 +020030#define DRIVER_VERSION "v0.03"
Oliver Neukumafba9372008-05-13 17:01:25 +020031#define DRIVER_AUTHOR "Oliver Neukum"
Oliver Neukum87d65e52008-06-19 14:20:18 +020032#define DRIVER_DESC "USB Abstract Control Model driver for USB WCM Device Management"
Oliver Neukumafba9372008-05-13 17:01:25 +020033
Bjørn Morkfec67b42012-01-25 13:03:29 +010034#define HUAWEI_VENDOR_ID 0x12D1
35
Németh Márton6ef48522010-01-10 15:33:45 +010036static const struct usb_device_id wdm_ids[] = {
Oliver Neukumafba9372008-05-13 17:01:25 +020037 {
38 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
39 USB_DEVICE_ID_MATCH_INT_SUBCLASS,
40 .bInterfaceClass = USB_CLASS_COMM,
41 .bInterfaceSubClass = USB_CDC_SUBCLASS_DMM
42 },
Bjørn Morkfec67b42012-01-25 13:03:29 +010043 {
44 /*
45 * Huawei E392, E398 and possibly other Qualcomm based modems
46 * embed the Qualcomm QMI protocol inside CDC on CDC ECM like
47 * control interfaces. Userspace access to this is required
48 * to configure the accompanying data interface
49 */
50 .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
51 USB_DEVICE_ID_MATCH_INT_INFO,
52 .idVendor = HUAWEI_VENDOR_ID,
53 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
54 .bInterfaceSubClass = 1,
55 .bInterfaceProtocol = 9, /* NOTE: CDC ECM control interface! */
56 },
Oliver Neukumafba9372008-05-13 17:01:25 +020057 { }
58};
59
Oliver Neukumaa5380b2008-10-13 14:05:20 +020060MODULE_DEVICE_TABLE (usb, wdm_ids);
61
Oliver Neukumafba9372008-05-13 17:01:25 +020062#define WDM_MINOR_BASE 176
63
64
65#define WDM_IN_USE 1
66#define WDM_DISCONNECTING 2
67#define WDM_RESULT 3
68#define WDM_READ 4
69#define WDM_INT_STALL 5
70#define WDM_POLL_RUNNING 6
Oliver Neukum922a5ea2010-02-27 20:54:59 +010071#define WDM_RESPONDING 7
Oliver Neukumbeb1d352010-02-27 20:55:52 +010072#define WDM_SUSPENDING 8
Bjørn Mork88044202012-02-10 09:44:08 +010073#define WDM_RESETTING 9
Oliver Neukumafba9372008-05-13 17:01:25 +020074
75#define WDM_MAX 16
76
Bjørn Mork7e3054a2012-01-20 01:49:57 +010077/* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 decimal (0x100)" */
78#define WDM_DEFAULT_BUFSIZE 256
Oliver Neukumafba9372008-05-13 17:01:25 +020079
80static DEFINE_MUTEX(wdm_mutex);
Bjørn Morkb0c13862012-03-06 17:29:21 +010081static DEFINE_SPINLOCK(wdm_device_list_lock);
82static LIST_HEAD(wdm_device_list);
Oliver Neukumafba9372008-05-13 17:01:25 +020083
84/* --- method tables --- */
85
86struct wdm_device {
87 u8 *inbuf; /* buffer for response */
88 u8 *outbuf; /* buffer for command */
89 u8 *sbuf; /* buffer for status */
90 u8 *ubuf; /* buffer for copy to user space */
91
92 struct urb *command;
93 struct urb *response;
94 struct urb *validity;
95 struct usb_interface *intf;
96 struct usb_ctrlrequest *orq;
97 struct usb_ctrlrequest *irq;
98 spinlock_t iuspin;
99
100 unsigned long flags;
101 u16 bufsize;
102 u16 wMaxCommand;
103 u16 wMaxPacketSize;
Oliver Neukumafba9372008-05-13 17:01:25 +0200104 __le16 inum;
105 int reslength;
106 int length;
107 int read;
108 int count;
109 dma_addr_t shandle;
110 dma_addr_t ihandle;
Bjørn Morke8537bd2012-01-16 12:41:48 +0100111 struct mutex wlock;
112 struct mutex rlock;
Oliver Neukumafba9372008-05-13 17:01:25 +0200113 wait_queue_head_t wait;
114 struct work_struct rxwork;
115 int werr;
116 int rerr;
Bjørn Morkb0c13862012-03-06 17:29:21 +0100117
118 struct list_head device_list;
Oliver Neukumafba9372008-05-13 17:01:25 +0200119};
120
121static struct usb_driver wdm_driver;
122
Bjørn Morkb0c13862012-03-06 17:29:21 +0100123/* return intfdata if we own the interface, else look up intf in the list */
124static struct wdm_device *wdm_find_device(struct usb_interface *intf)
125{
126 struct wdm_device *desc = NULL;
127
128 spin_lock(&wdm_device_list_lock);
129 list_for_each_entry(desc, &wdm_device_list, device_list)
130 if (desc->intf == intf)
131 break;
132 spin_unlock(&wdm_device_list_lock);
133
134 return desc;
135}
136
137static struct wdm_device *wdm_find_device_by_minor(int minor)
138{
139 struct wdm_device *desc = NULL;
140
141 spin_lock(&wdm_device_list_lock);
142 list_for_each_entry(desc, &wdm_device_list, device_list)
143 if (desc->intf->minor == minor)
144 break;
145 spin_unlock(&wdm_device_list_lock);
146
147 return desc;
148}
149
Oliver Neukumafba9372008-05-13 17:01:25 +0200150/* --- callbacks --- */
151static void wdm_out_callback(struct urb *urb)
152{
153 struct wdm_device *desc;
154 desc = urb->context;
155 spin_lock(&desc->iuspin);
156 desc->werr = urb->status;
157 spin_unlock(&desc->iuspin);
158 clear_bit(WDM_IN_USE, &desc->flags);
159 kfree(desc->outbuf);
160 wake_up(&desc->wait);
161}
162
163static void wdm_in_callback(struct urb *urb)
164{
165 struct wdm_device *desc = urb->context;
166 int status = urb->status;
167
168 spin_lock(&desc->iuspin);
Oliver Neukum922a5ea2010-02-27 20:54:59 +0100169 clear_bit(WDM_RESPONDING, &desc->flags);
Oliver Neukumafba9372008-05-13 17:01:25 +0200170
171 if (status) {
172 switch (status) {
173 case -ENOENT:
174 dev_dbg(&desc->intf->dev,
175 "nonzero urb status received: -ENOENT");
Oliver Neukum922a5ea2010-02-27 20:54:59 +0100176 goto skip_error;
Oliver Neukumafba9372008-05-13 17:01:25 +0200177 case -ECONNRESET:
178 dev_dbg(&desc->intf->dev,
179 "nonzero urb status received: -ECONNRESET");
Oliver Neukum922a5ea2010-02-27 20:54:59 +0100180 goto skip_error;
Oliver Neukumafba9372008-05-13 17:01:25 +0200181 case -ESHUTDOWN:
182 dev_dbg(&desc->intf->dev,
183 "nonzero urb status received: -ESHUTDOWN");
Oliver Neukum922a5ea2010-02-27 20:54:59 +0100184 goto skip_error;
Oliver Neukumafba9372008-05-13 17:01:25 +0200185 case -EPIPE:
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700186 dev_err(&desc->intf->dev,
187 "nonzero urb status received: -EPIPE\n");
Oliver Neukumafba9372008-05-13 17:01:25 +0200188 break;
189 default:
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700190 dev_err(&desc->intf->dev,
191 "Unexpected error %d\n", status);
Oliver Neukumafba9372008-05-13 17:01:25 +0200192 break;
193 }
194 }
195
196 desc->rerr = status;
197 desc->reslength = urb->actual_length;
198 memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength);
199 desc->length += desc->reslength;
Oliver Neukum922a5ea2010-02-27 20:54:59 +0100200skip_error:
Oliver Neukumafba9372008-05-13 17:01:25 +0200201 wake_up(&desc->wait);
202
203 set_bit(WDM_READ, &desc->flags);
204 spin_unlock(&desc->iuspin);
205}
206
207static void wdm_int_callback(struct urb *urb)
208{
209 int rv = 0;
210 int status = urb->status;
211 struct wdm_device *desc;
Oliver Neukumafba9372008-05-13 17:01:25 +0200212 struct usb_cdc_notification *dr;
213
214 desc = urb->context;
Oliver Neukumafba9372008-05-13 17:01:25 +0200215 dr = (struct usb_cdc_notification *)desc->sbuf;
216
217 if (status) {
218 switch (status) {
219 case -ESHUTDOWN:
220 case -ENOENT:
221 case -ECONNRESET:
222 return; /* unplug */
223 case -EPIPE:
224 set_bit(WDM_INT_STALL, &desc->flags);
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700225 dev_err(&desc->intf->dev, "Stall on int endpoint\n");
Oliver Neukumafba9372008-05-13 17:01:25 +0200226 goto sw; /* halt is cleared in work */
227 default:
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700228 dev_err(&desc->intf->dev,
229 "nonzero urb status received: %d\n", status);
Oliver Neukumafba9372008-05-13 17:01:25 +0200230 break;
231 }
232 }
233
234 if (urb->actual_length < sizeof(struct usb_cdc_notification)) {
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700235 dev_err(&desc->intf->dev, "wdm_int_callback - %d bytes\n",
236 urb->actual_length);
Oliver Neukumafba9372008-05-13 17:01:25 +0200237 goto exit;
238 }
239
240 switch (dr->bNotificationType) {
241 case USB_CDC_NOTIFY_RESPONSE_AVAILABLE:
242 dev_dbg(&desc->intf->dev,
243 "NOTIFY_RESPONSE_AVAILABLE received: index %d len %d",
244 dr->wIndex, dr->wLength);
245 break;
246
247 case USB_CDC_NOTIFY_NETWORK_CONNECTION:
248
249 dev_dbg(&desc->intf->dev,
250 "NOTIFY_NETWORK_CONNECTION %s network",
251 dr->wValue ? "connected to" : "disconnected from");
252 goto exit;
253 default:
254 clear_bit(WDM_POLL_RUNNING, &desc->flags);
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700255 dev_err(&desc->intf->dev,
256 "unknown notification %d received: index %d len %d\n",
Oliver Neukumafba9372008-05-13 17:01:25 +0200257 dr->bNotificationType, dr->wIndex, dr->wLength);
258 goto exit;
259 }
260
Oliver Neukumafba9372008-05-13 17:01:25 +0200261 spin_lock(&desc->iuspin);
262 clear_bit(WDM_READ, &desc->flags);
Oliver Neukum922a5ea2010-02-27 20:54:59 +0100263 set_bit(WDM_RESPONDING, &desc->flags);
Oliver Neukumbeb1d352010-02-27 20:55:52 +0100264 if (!test_bit(WDM_DISCONNECTING, &desc->flags)
265 && !test_bit(WDM_SUSPENDING, &desc->flags)) {
Oliver Neukumafba9372008-05-13 17:01:25 +0200266 rv = usb_submit_urb(desc->response, GFP_ATOMIC);
267 dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d",
268 __func__, rv);
269 }
270 spin_unlock(&desc->iuspin);
271 if (rv < 0) {
Oliver Neukum922a5ea2010-02-27 20:54:59 +0100272 clear_bit(WDM_RESPONDING, &desc->flags);
Oliver Neukumafba9372008-05-13 17:01:25 +0200273 if (rv == -EPERM)
274 return;
275 if (rv == -ENOMEM) {
276sw:
277 rv = schedule_work(&desc->rxwork);
278 if (rv)
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700279 dev_err(&desc->intf->dev,
280 "Cannot schedule work\n");
Oliver Neukumafba9372008-05-13 17:01:25 +0200281 }
282 }
283exit:
284 rv = usb_submit_urb(urb, GFP_ATOMIC);
285 if (rv)
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700286 dev_err(&desc->intf->dev,
287 "%s - usb_submit_urb failed with result %d\n",
288 __func__, rv);
Oliver Neukumafba9372008-05-13 17:01:25 +0200289
290}
291
292static void kill_urbs(struct wdm_device *desc)
293{
Oliver Neukum17d80d52008-06-24 15:56:10 +0200294 /* the order here is essential */
Oliver Neukumafba9372008-05-13 17:01:25 +0200295 usb_kill_urb(desc->command);
296 usb_kill_urb(desc->validity);
297 usb_kill_urb(desc->response);
298}
299
300static void free_urbs(struct wdm_device *desc)
301{
302 usb_free_urb(desc->validity);
303 usb_free_urb(desc->response);
304 usb_free_urb(desc->command);
305}
306
307static void cleanup(struct wdm_device *desc)
308{
Bjørn Morkb0c13862012-03-06 17:29:21 +0100309 spin_lock(&wdm_device_list_lock);
310 list_del(&desc->device_list);
311 spin_unlock(&wdm_device_list_lock);
Bjørn Mork8457d992012-01-16 15:12:00 +0100312 kfree(desc->sbuf);
313 kfree(desc->inbuf);
Oliver Neukumafba9372008-05-13 17:01:25 +0200314 kfree(desc->orq);
315 kfree(desc->irq);
316 kfree(desc->ubuf);
317 free_urbs(desc);
318 kfree(desc);
319}
320
321static ssize_t wdm_write
322(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
323{
324 u8 *buf;
325 int rv = -EMSGSIZE, r, we;
326 struct wdm_device *desc = file->private_data;
327 struct usb_ctrlrequest *req;
328
329 if (count > desc->wMaxCommand)
330 count = desc->wMaxCommand;
331
332 spin_lock_irq(&desc->iuspin);
333 we = desc->werr;
334 desc->werr = 0;
335 spin_unlock_irq(&desc->iuspin);
336 if (we < 0)
337 return -EIO;
338
Oliver Neukum860e41a2010-02-27 20:54:24 +0100339 desc->outbuf = buf = kmalloc(count, GFP_KERNEL);
340 if (!buf) {
341 rv = -ENOMEM;
Oliver Neukumafba9372008-05-13 17:01:25 +0200342 goto outnl;
Oliver Neukum860e41a2010-02-27 20:54:24 +0100343 }
344
345 r = copy_from_user(buf, buffer, count);
346 if (r > 0) {
347 kfree(buf);
348 rv = -EFAULT;
349 goto outnl;
350 }
351
352 /* concurrent writes and disconnect */
Bjørn Morke8537bd2012-01-16 12:41:48 +0100353 r = mutex_lock_interruptible(&desc->wlock);
Oliver Neukum860e41a2010-02-27 20:54:24 +0100354 rv = -ERESTARTSYS;
355 if (r) {
356 kfree(buf);
357 goto outnl;
358 }
359
360 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
361 kfree(buf);
362 rv = -ENODEV;
363 goto outnp;
364 }
Oliver Neukumafba9372008-05-13 17:01:25 +0200365
Oliver Neukum17d80d52008-06-24 15:56:10 +0200366 r = usb_autopm_get_interface(desc->intf);
Oliver Neukum860e41a2010-02-27 20:54:24 +0100367 if (r < 0) {
368 kfree(buf);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200369 goto outnp;
Oliver Neukum860e41a2010-02-27 20:54:24 +0100370 }
Oliver Neukum7f1dc313d2009-09-09 10:12:48 +0200371
David Sterba0cdfb812010-12-27 18:49:58 +0100372 if (!(file->f_flags & O_NONBLOCK))
Oliver Neukum7f1dc313d2009-09-09 10:12:48 +0200373 r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE,
374 &desc->flags));
375 else
376 if (test_bit(WDM_IN_USE, &desc->flags))
377 r = -EAGAIN;
Bjørn Mork88044202012-02-10 09:44:08 +0100378
379 if (test_bit(WDM_RESETTING, &desc->flags))
380 r = -EIO;
381
Oliver Neukum860e41a2010-02-27 20:54:24 +0100382 if (r < 0) {
Oliver Neukumafba9372008-05-13 17:01:25 +0200383 kfree(buf);
Oliver Neukumafba9372008-05-13 17:01:25 +0200384 goto out;
385 }
386
387 req = desc->orq;
388 usb_fill_control_urb(
389 desc->command,
390 interface_to_usbdev(desc->intf),
391 /* using common endpoint 0 */
392 usb_sndctrlpipe(interface_to_usbdev(desc->intf), 0),
393 (unsigned char *)req,
394 buf,
395 count,
396 wdm_out_callback,
397 desc
398 );
399
400 req->bRequestType = (USB_DIR_OUT | USB_TYPE_CLASS |
401 USB_RECIP_INTERFACE);
402 req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND;
403 req->wValue = 0;
404 req->wIndex = desc->inum;
405 req->wLength = cpu_to_le16(count);
406 set_bit(WDM_IN_USE, &desc->flags);
407
408 rv = usb_submit_urb(desc->command, GFP_KERNEL);
409 if (rv < 0) {
410 kfree(buf);
411 clear_bit(WDM_IN_USE, &desc->flags);
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700412 dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv);
Oliver Neukumafba9372008-05-13 17:01:25 +0200413 } else {
414 dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d",
415 req->wIndex);
416 }
417out:
Oliver Neukum17d80d52008-06-24 15:56:10 +0200418 usb_autopm_put_interface(desc->intf);
419outnp:
Bjørn Morke8537bd2012-01-16 12:41:48 +0100420 mutex_unlock(&desc->wlock);
Oliver Neukumafba9372008-05-13 17:01:25 +0200421outnl:
422 return rv < 0 ? rv : count;
423}
424
425static ssize_t wdm_read
426(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
427{
Ben Hutchings711c68b2012-02-12 06:00:41 +0000428 int rv, cntr;
Oliver Neukumafba9372008-05-13 17:01:25 +0200429 int i = 0;
430 struct wdm_device *desc = file->private_data;
431
432
Bjørn Morke8537bd2012-01-16 12:41:48 +0100433 rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */
Oliver Neukumafba9372008-05-13 17:01:25 +0200434 if (rv < 0)
435 return -ERESTARTSYS;
436
Ben Hutchings711c68b2012-02-12 06:00:41 +0000437 cntr = ACCESS_ONCE(desc->length);
438 if (cntr == 0) {
Oliver Neukumafba9372008-05-13 17:01:25 +0200439 desc->read = 0;
440retry:
Oliver Neukum7f1dc313d2009-09-09 10:12:48 +0200441 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
442 rv = -ENODEV;
443 goto err;
444 }
Oliver Neukumafba9372008-05-13 17:01:25 +0200445 i++;
Oliver Neukum7f1dc313d2009-09-09 10:12:48 +0200446 if (file->f_flags & O_NONBLOCK) {
447 if (!test_bit(WDM_READ, &desc->flags)) {
448 rv = cntr ? cntr : -EAGAIN;
449 goto err;
450 }
451 rv = 0;
452 } else {
453 rv = wait_event_interruptible(desc->wait,
454 test_bit(WDM_READ, &desc->flags));
455 }
Oliver Neukumafba9372008-05-13 17:01:25 +0200456
Oliver Neukum7f1dc313d2009-09-09 10:12:48 +0200457 /* may have happened while we slept */
Oliver Neukum17d80d52008-06-24 15:56:10 +0200458 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
459 rv = -ENODEV;
460 goto err;
461 }
Bjørn Mork88044202012-02-10 09:44:08 +0100462 if (test_bit(WDM_RESETTING, &desc->flags)) {
463 rv = -EIO;
464 goto err;
465 }
Oliver Neukum17d80d52008-06-24 15:56:10 +0200466 usb_mark_last_busy(interface_to_usbdev(desc->intf));
Oliver Neukumafba9372008-05-13 17:01:25 +0200467 if (rv < 0) {
468 rv = -ERESTARTSYS;
469 goto err;
470 }
471
472 spin_lock_irq(&desc->iuspin);
473
474 if (desc->rerr) { /* read completed, error happened */
Oliver Neukumafba9372008-05-13 17:01:25 +0200475 desc->rerr = 0;
476 spin_unlock_irq(&desc->iuspin);
Oliver Neukumafba9372008-05-13 17:01:25 +0200477 rv = -EIO;
478 goto err;
479 }
480 /*
481 * recheck whether we've lost the race
482 * against the completion handler
483 */
484 if (!test_bit(WDM_READ, &desc->flags)) { /* lost race */
485 spin_unlock_irq(&desc->iuspin);
486 goto retry;
487 }
488 if (!desc->reslength) { /* zero length read */
489 spin_unlock_irq(&desc->iuspin);
490 goto retry;
491 }
Ben Hutchings711c68b2012-02-12 06:00:41 +0000492 cntr = desc->length;
Oliver Neukumafba9372008-05-13 17:01:25 +0200493 spin_unlock_irq(&desc->iuspin);
494 }
495
Ben Hutchings711c68b2012-02-12 06:00:41 +0000496 if (cntr > count)
497 cntr = count;
Oliver Neukumafba9372008-05-13 17:01:25 +0200498 rv = copy_to_user(buffer, desc->ubuf, cntr);
499 if (rv > 0) {
500 rv = -EFAULT;
501 goto err;
502 }
503
Ben Hutchings711c68b2012-02-12 06:00:41 +0000504 spin_lock_irq(&desc->iuspin);
505
Oliver Neukumafba9372008-05-13 17:01:25 +0200506 for (i = 0; i < desc->length - cntr; i++)
507 desc->ubuf[i] = desc->ubuf[i + cntr];
508
509 desc->length -= cntr;
Oliver Neukum87d65e52008-06-19 14:20:18 +0200510 /* in case we had outstanding data */
511 if (!desc->length)
512 clear_bit(WDM_READ, &desc->flags);
Ben Hutchings711c68b2012-02-12 06:00:41 +0000513
514 spin_unlock_irq(&desc->iuspin);
515
Oliver Neukumafba9372008-05-13 17:01:25 +0200516 rv = cntr;
517
518err:
Bjørn Morke8537bd2012-01-16 12:41:48 +0100519 mutex_unlock(&desc->rlock);
Oliver Neukumafba9372008-05-13 17:01:25 +0200520 return rv;
521}
522
523static int wdm_flush(struct file *file, fl_owner_t id)
524{
525 struct wdm_device *desc = file->private_data;
526
527 wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags));
528 if (desc->werr < 0)
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700529 dev_err(&desc->intf->dev, "Error in flush path: %d\n",
530 desc->werr);
Oliver Neukumafba9372008-05-13 17:01:25 +0200531
532 return desc->werr;
533}
534
535static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait)
536{
537 struct wdm_device *desc = file->private_data;
538 unsigned long flags;
539 unsigned int mask = 0;
540
541 spin_lock_irqsave(&desc->iuspin, flags);
542 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
543 mask = POLLERR;
544 spin_unlock_irqrestore(&desc->iuspin, flags);
545 goto desc_out;
546 }
547 if (test_bit(WDM_READ, &desc->flags))
548 mask = POLLIN | POLLRDNORM;
549 if (desc->rerr || desc->werr)
550 mask |= POLLERR;
551 if (!test_bit(WDM_IN_USE, &desc->flags))
552 mask |= POLLOUT | POLLWRNORM;
553 spin_unlock_irqrestore(&desc->iuspin, flags);
554
555 poll_wait(file, &desc->wait, wait);
556
557desc_out:
558 return mask;
559}
560
561static int wdm_open(struct inode *inode, struct file *file)
562{
563 int minor = iminor(inode);
564 int rv = -ENODEV;
565 struct usb_interface *intf;
566 struct wdm_device *desc;
567
568 mutex_lock(&wdm_mutex);
Bjørn Morkb0c13862012-03-06 17:29:21 +0100569 desc = wdm_find_device_by_minor(minor);
570 if (!desc)
Oliver Neukumafba9372008-05-13 17:01:25 +0200571 goto out;
572
Bjørn Morkb0c13862012-03-06 17:29:21 +0100573 intf = desc->intf;
Oliver Neukumafba9372008-05-13 17:01:25 +0200574 if (test_bit(WDM_DISCONNECTING, &desc->flags))
575 goto out;
Oliver Neukumafba9372008-05-13 17:01:25 +0200576 file->private_data = desc;
577
Oliver Neukum17d80d52008-06-24 15:56:10 +0200578 rv = usb_autopm_get_interface(desc->intf);
Oliver Neukumafba9372008-05-13 17:01:25 +0200579 if (rv < 0) {
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700580 dev_err(&desc->intf->dev, "Error autopm - %d\n", rv);
Oliver Neukumafba9372008-05-13 17:01:25 +0200581 goto out;
582 }
Oliver Neukum17d80d52008-06-24 15:56:10 +0200583 intf->needs_remote_wakeup = 1;
Oliver Neukumafba9372008-05-13 17:01:25 +0200584
Bjørn Morke8537bd2012-01-16 12:41:48 +0100585 /* using write lock to protect desc->count */
586 mutex_lock(&desc->wlock);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200587 if (!desc->count++) {
Oliver Neukumd771d8a2011-04-29 14:12:21 +0200588 desc->werr = 0;
589 desc->rerr = 0;
Oliver Neukum17d80d52008-06-24 15:56:10 +0200590 rv = usb_submit_urb(desc->validity, GFP_KERNEL);
591 if (rv < 0) {
592 desc->count--;
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700593 dev_err(&desc->intf->dev,
594 "Error submitting int urb - %d\n", rv);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200595 }
596 } else {
597 rv = 0;
598 }
Bjørn Morke8537bd2012-01-16 12:41:48 +0100599 mutex_unlock(&desc->wlock);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200600 usb_autopm_put_interface(desc->intf);
Oliver Neukumafba9372008-05-13 17:01:25 +0200601out:
602 mutex_unlock(&wdm_mutex);
603 return rv;
604}
605
606static int wdm_release(struct inode *inode, struct file *file)
607{
608 struct wdm_device *desc = file->private_data;
609
610 mutex_lock(&wdm_mutex);
Bjørn Morke8537bd2012-01-16 12:41:48 +0100611
612 /* using write lock to protect desc->count */
613 mutex_lock(&desc->wlock);
Oliver Neukumafba9372008-05-13 17:01:25 +0200614 desc->count--;
Bjørn Morke8537bd2012-01-16 12:41:48 +0100615 mutex_unlock(&desc->wlock);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200616
Oliver Neukumafba9372008-05-13 17:01:25 +0200617 if (!desc->count) {
618 dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
619 kill_urbs(desc);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200620 if (!test_bit(WDM_DISCONNECTING, &desc->flags))
621 desc->intf->needs_remote_wakeup = 0;
Oliver Neukumafba9372008-05-13 17:01:25 +0200622 }
623 mutex_unlock(&wdm_mutex);
624 return 0;
625}
626
627static const struct file_operations wdm_fops = {
628 .owner = THIS_MODULE,
629 .read = wdm_read,
630 .write = wdm_write,
631 .open = wdm_open,
632 .flush = wdm_flush,
633 .release = wdm_release,
Arnd Bergmann6038f372010-08-15 18:52:59 +0200634 .poll = wdm_poll,
635 .llseek = noop_llseek,
Oliver Neukumafba9372008-05-13 17:01:25 +0200636};
637
638static struct usb_class_driver wdm_class = {
639 .name = "cdc-wdm%d",
640 .fops = &wdm_fops,
641 .minor_base = WDM_MINOR_BASE,
642};
643
644/* --- error handling --- */
645static void wdm_rxwork(struct work_struct *work)
646{
647 struct wdm_device *desc = container_of(work, struct wdm_device, rxwork);
648 unsigned long flags;
649 int rv;
650
651 spin_lock_irqsave(&desc->iuspin, flags);
652 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
653 spin_unlock_irqrestore(&desc->iuspin, flags);
654 } else {
655 spin_unlock_irqrestore(&desc->iuspin, flags);
656 rv = usb_submit_urb(desc->response, GFP_KERNEL);
657 if (rv < 0 && rv != -EPERM) {
658 spin_lock_irqsave(&desc->iuspin, flags);
659 if (!test_bit(WDM_DISCONNECTING, &desc->flags))
660 schedule_work(&desc->rxwork);
661 spin_unlock_irqrestore(&desc->iuspin, flags);
662 }
663 }
664}
665
666/* --- hotplug --- */
667
Bjørn Mork0dffb482012-03-06 17:29:20 +0100668static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor *ep, u16 bufsize)
Oliver Neukumafba9372008-05-13 17:01:25 +0200669{
Bjørn Mork0dffb482012-03-06 17:29:20 +0100670 int rv = -ENOMEM;
Oliver Neukumafba9372008-05-13 17:01:25 +0200671 struct wdm_device *desc;
Oliver Neukumafba9372008-05-13 17:01:25 +0200672
Oliver Neukumafba9372008-05-13 17:01:25 +0200673 desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL);
674 if (!desc)
675 goto out;
Bjørn Morkb0c13862012-03-06 17:29:21 +0100676 INIT_LIST_HEAD(&desc->device_list);
Bjørn Morke8537bd2012-01-16 12:41:48 +0100677 mutex_init(&desc->rlock);
678 mutex_init(&desc->wlock);
Oliver Neukumafba9372008-05-13 17:01:25 +0200679 spin_lock_init(&desc->iuspin);
680 init_waitqueue_head(&desc->wait);
Bjørn Mork0dffb482012-03-06 17:29:20 +0100681 desc->wMaxCommand = bufsize;
Oliver Neukum052fbc02009-04-20 17:24:49 +0200682 /* this will be expanded and needed in hardware endianness */
Oliver Neukumafba9372008-05-13 17:01:25 +0200683 desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber);
684 desc->intf = intf;
685 INIT_WORK(&desc->rxwork, wdm_rxwork);
686
Oliver Neukum052fbc02009-04-20 17:24:49 +0200687 rv = -EINVAL;
Bjørn Mork0dffb482012-03-06 17:29:20 +0100688 if (!usb_endpoint_is_int_in(ep))
Oliver Neukum052fbc02009-04-20 17:24:49 +0200689 goto err;
Oliver Neukumafba9372008-05-13 17:01:25 +0200690
Kuninori Morimoto29cc8892011-08-23 03:12:03 -0700691 desc->wMaxPacketSize = usb_endpoint_maxp(ep);
Oliver Neukumafba9372008-05-13 17:01:25 +0200692
693 desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
694 if (!desc->orq)
695 goto err;
696 desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
697 if (!desc->irq)
698 goto err;
699
700 desc->validity = usb_alloc_urb(0, GFP_KERNEL);
701 if (!desc->validity)
702 goto err;
703
704 desc->response = usb_alloc_urb(0, GFP_KERNEL);
705 if (!desc->response)
706 goto err;
707
708 desc->command = usb_alloc_urb(0, GFP_KERNEL);
709 if (!desc->command)
710 goto err;
711
712 desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL);
713 if (!desc->ubuf)
714 goto err;
715
Bjørn Mork8457d992012-01-16 15:12:00 +0100716 desc->sbuf = kmalloc(desc->wMaxPacketSize, GFP_KERNEL);
Oliver Neukumafba9372008-05-13 17:01:25 +0200717 if (!desc->sbuf)
718 goto err;
719
Bjørn Mork8457d992012-01-16 15:12:00 +0100720 desc->inbuf = kmalloc(desc->wMaxCommand, GFP_KERNEL);
Oliver Neukumafba9372008-05-13 17:01:25 +0200721 if (!desc->inbuf)
Bjørn Mork8457d992012-01-16 15:12:00 +0100722 goto err;
Oliver Neukumafba9372008-05-13 17:01:25 +0200723
724 usb_fill_int_urb(
725 desc->validity,
726 interface_to_usbdev(intf),
727 usb_rcvintpipe(interface_to_usbdev(intf), ep->bEndpointAddress),
728 desc->sbuf,
729 desc->wMaxPacketSize,
730 wdm_int_callback,
731 desc,
732 ep->bInterval
733 );
Oliver Neukumafba9372008-05-13 17:01:25 +0200734
Bjørn Mork19b85b32012-01-16 15:11:58 +0100735 desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
736 desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE;
737 desc->irq->wValue = 0;
738 desc->irq->wIndex = desc->inum;
739 desc->irq->wLength = cpu_to_le16(desc->wMaxCommand);
740
741 usb_fill_control_urb(
742 desc->response,
Bjørn Mork8143a892012-01-16 15:12:01 +0100743 interface_to_usbdev(intf),
Bjørn Mork19b85b32012-01-16 15:11:58 +0100744 /* using common endpoint 0 */
745 usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0),
746 (unsigned char *)desc->irq,
747 desc->inbuf,
748 desc->wMaxCommand,
749 wdm_in_callback,
750 desc
751 );
Bjørn Mork19b85b32012-01-16 15:11:58 +0100752
Bjørn Morkb0c13862012-03-06 17:29:21 +0100753 spin_lock(&wdm_device_list_lock);
754 list_add(&desc->device_list, &wdm_device_list);
755 spin_unlock(&wdm_device_list_lock);
756
Oliver Neukumafba9372008-05-13 17:01:25 +0200757 rv = usb_register_dev(intf, &wdm_class);
Oliver Neukumafba9372008-05-13 17:01:25 +0200758 if (rv < 0)
Bjørn Morkb0c13862012-03-06 17:29:21 +0100759 goto err;
Oliver Neukum052fbc02009-04-20 17:24:49 +0200760 else
Bjørn Mork820c6292012-01-20 04:17:25 +0100761 dev_info(&intf->dev, "%s: USB WDM device\n", dev_name(intf->usb_dev));
Oliver Neukumafba9372008-05-13 17:01:25 +0200762out:
763 return rv;
Oliver Neukumafba9372008-05-13 17:01:25 +0200764err:
Bjørn Mork0dffb482012-03-06 17:29:20 +0100765 cleanup(desc);
766 return rv;
767}
768
769static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
770{
771 int rv = -EINVAL;
772 struct usb_host_interface *iface;
773 struct usb_endpoint_descriptor *ep;
774 struct usb_cdc_dmm_desc *dmhd;
775 u8 *buffer = intf->altsetting->extra;
776 int buflen = intf->altsetting->extralen;
777 u16 maxcom = WDM_DEFAULT_BUFSIZE;
778
779 if (!buffer)
780 goto err;
781 while (buflen > 2) {
782 if (buffer[1] != USB_DT_CS_INTERFACE) {
783 dev_err(&intf->dev, "skipping garbage\n");
784 goto next_desc;
785 }
786
787 switch (buffer[2]) {
788 case USB_CDC_HEADER_TYPE:
789 break;
790 case USB_CDC_DMM_TYPE:
791 dmhd = (struct usb_cdc_dmm_desc *)buffer;
792 maxcom = le16_to_cpu(dmhd->wMaxCommand);
793 dev_dbg(&intf->dev,
794 "Finding maximum buffer length: %d", maxcom);
795 break;
796 default:
797 dev_err(&intf->dev,
798 "Ignoring extra header, type %d, length %d\n",
799 buffer[2], buffer[0]);
800 break;
801 }
802next_desc:
803 buflen -= buffer[0];
804 buffer += buffer[0];
805 }
806
807 iface = intf->cur_altsetting;
808 if (iface->desc.bNumEndpoints != 1)
809 goto err;
810 ep = &iface->endpoint[0].desc;
811
812 rv = wdm_create(intf, ep, maxcom);
813
814err:
Oliver Neukumafba9372008-05-13 17:01:25 +0200815 return rv;
816}
817
818static void wdm_disconnect(struct usb_interface *intf)
819{
820 struct wdm_device *desc;
821 unsigned long flags;
822
823 usb_deregister_dev(intf, &wdm_class);
Bjørn Morkb0c13862012-03-06 17:29:21 +0100824 desc = wdm_find_device(intf);
Oliver Neukumafba9372008-05-13 17:01:25 +0200825 mutex_lock(&wdm_mutex);
Oliver Neukumafba9372008-05-13 17:01:25 +0200826
827 /* the spinlock makes sure no new urbs are generated in the callbacks */
828 spin_lock_irqsave(&desc->iuspin, flags);
829 set_bit(WDM_DISCONNECTING, &desc->flags);
830 set_bit(WDM_READ, &desc->flags);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200831 /* to terminate pending flushes */
Oliver Neukumafba9372008-05-13 17:01:25 +0200832 clear_bit(WDM_IN_USE, &desc->flags);
833 spin_unlock_irqrestore(&desc->iuspin, flags);
Bjørn Mork62aaf242012-01-16 15:11:57 +0100834 wake_up_all(&desc->wait);
Bjørn Morke8537bd2012-01-16 12:41:48 +0100835 mutex_lock(&desc->rlock);
836 mutex_lock(&desc->wlock);
Oliver Neukumafba9372008-05-13 17:01:25 +0200837 kill_urbs(desc);
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100838 cancel_work_sync(&desc->rxwork);
Bjørn Morke8537bd2012-01-16 12:41:48 +0100839 mutex_unlock(&desc->wlock);
840 mutex_unlock(&desc->rlock);
Oliver Neukumafba9372008-05-13 17:01:25 +0200841 if (!desc->count)
842 cleanup(desc);
843 mutex_unlock(&wdm_mutex);
844}
845
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100846#ifdef CONFIG_PM
Oliver Neukum17d80d52008-06-24 15:56:10 +0200847static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
848{
Bjørn Morkb0c13862012-03-06 17:29:21 +0100849 struct wdm_device *desc = wdm_find_device(intf);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200850 int rv = 0;
851
852 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);
853
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100854 /* if this is an autosuspend the caller does the locking */
Bjørn Morke8537bd2012-01-16 12:41:48 +0100855 if (!PMSG_IS_AUTO(message)) {
856 mutex_lock(&desc->rlock);
857 mutex_lock(&desc->wlock);
858 }
Oliver Neukum62e66852010-02-27 20:56:22 +0100859 spin_lock_irq(&desc->iuspin);
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100860
Alan Stern5b1b0b82011-08-19 23:49:48 +0200861 if (PMSG_IS_AUTO(message) &&
Oliver Neukum922a5ea2010-02-27 20:54:59 +0100862 (test_bit(WDM_IN_USE, &desc->flags)
863 || test_bit(WDM_RESPONDING, &desc->flags))) {
Oliver Neukum62e66852010-02-27 20:56:22 +0100864 spin_unlock_irq(&desc->iuspin);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200865 rv = -EBUSY;
866 } else {
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100867
Oliver Neukumbeb1d352010-02-27 20:55:52 +0100868 set_bit(WDM_SUSPENDING, &desc->flags);
Oliver Neukum62e66852010-02-27 20:56:22 +0100869 spin_unlock_irq(&desc->iuspin);
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100870 /* callback submits work - order is essential */
Oliver Neukum17d80d52008-06-24 15:56:10 +0200871 kill_urbs(desc);
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100872 cancel_work_sync(&desc->rxwork);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200873 }
Bjørn Morke8537bd2012-01-16 12:41:48 +0100874 if (!PMSG_IS_AUTO(message)) {
875 mutex_unlock(&desc->wlock);
876 mutex_unlock(&desc->rlock);
877 }
Oliver Neukum17d80d52008-06-24 15:56:10 +0200878
879 return rv;
880}
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100881#endif
Oliver Neukum17d80d52008-06-24 15:56:10 +0200882
883static int recover_from_urb_loss(struct wdm_device *desc)
884{
885 int rv = 0;
886
887 if (desc->count) {
888 rv = usb_submit_urb(desc->validity, GFP_NOIO);
889 if (rv < 0)
Greg Kroah-Hartman9908a322008-08-14 09:37:34 -0700890 dev_err(&desc->intf->dev,
891 "Error resume submitting int urb - %d\n", rv);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200892 }
893 return rv;
894}
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100895
896#ifdef CONFIG_PM
Oliver Neukum17d80d52008-06-24 15:56:10 +0200897static int wdm_resume(struct usb_interface *intf)
898{
Bjørn Morkb0c13862012-03-06 17:29:21 +0100899 struct wdm_device *desc = wdm_find_device(intf);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200900 int rv;
901
902 dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor);
Oliver Neukum338124c2010-02-27 20:57:12 +0100903
Oliver Neukumbeb1d352010-02-27 20:55:52 +0100904 clear_bit(WDM_SUSPENDING, &desc->flags);
Oliver Neukum62e66852010-02-27 20:56:22 +0100905 rv = recover_from_urb_loss(desc);
Oliver Neukum338124c2010-02-27 20:57:12 +0100906
Oliver Neukum17d80d52008-06-24 15:56:10 +0200907 return rv;
908}
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100909#endif
Oliver Neukum17d80d52008-06-24 15:56:10 +0200910
911static int wdm_pre_reset(struct usb_interface *intf)
912{
Bjørn Morkb0c13862012-03-06 17:29:21 +0100913 struct wdm_device *desc = wdm_find_device(intf);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200914
Oliver Neukumd771d8a2011-04-29 14:12:21 +0200915 /*
916 * we notify everybody using poll of
917 * an exceptional situation
918 * must be done before recovery lest a spontaneous
919 * message from the device is lost
920 */
921 spin_lock_irq(&desc->iuspin);
Bjørn Mork88044202012-02-10 09:44:08 +0100922 set_bit(WDM_RESETTING, &desc->flags); /* inform read/write */
923 set_bit(WDM_READ, &desc->flags); /* unblock read */
924 clear_bit(WDM_IN_USE, &desc->flags); /* unblock write */
Oliver Neukumd771d8a2011-04-29 14:12:21 +0200925 desc->rerr = -EINTR;
926 spin_unlock_irq(&desc->iuspin);
927 wake_up_all(&desc->wait);
Bjørn Mork88044202012-02-10 09:44:08 +0100928 mutex_lock(&desc->rlock);
929 mutex_lock(&desc->wlock);
930 kill_urbs(desc);
931 cancel_work_sync(&desc->rxwork);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200932 return 0;
933}
934
935static int wdm_post_reset(struct usb_interface *intf)
936{
Bjørn Morkb0c13862012-03-06 17:29:21 +0100937 struct wdm_device *desc = wdm_find_device(intf);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200938 int rv;
939
Bjørn Mork88044202012-02-10 09:44:08 +0100940 clear_bit(WDM_RESETTING, &desc->flags);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200941 rv = recover_from_urb_loss(desc);
Bjørn Morke8537bd2012-01-16 12:41:48 +0100942 mutex_unlock(&desc->wlock);
943 mutex_unlock(&desc->rlock);
Oliver Neukum17d80d52008-06-24 15:56:10 +0200944 return 0;
945}
946
Oliver Neukumafba9372008-05-13 17:01:25 +0200947static struct usb_driver wdm_driver = {
948 .name = "cdc_wdm",
949 .probe = wdm_probe,
950 .disconnect = wdm_disconnect,
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100951#ifdef CONFIG_PM
Oliver Neukum17d80d52008-06-24 15:56:10 +0200952 .suspend = wdm_suspend,
953 .resume = wdm_resume,
954 .reset_resume = wdm_resume,
Oliver Neukumd93d16e2010-02-27 20:56:47 +0100955#endif
Oliver Neukum17d80d52008-06-24 15:56:10 +0200956 .pre_reset = wdm_pre_reset,
957 .post_reset = wdm_post_reset,
Oliver Neukumafba9372008-05-13 17:01:25 +0200958 .id_table = wdm_ids,
Oliver Neukum17d80d52008-06-24 15:56:10 +0200959 .supports_autosuspend = 1,
Oliver Neukumafba9372008-05-13 17:01:25 +0200960};
961
Greg Kroah-Hartman65db4302011-11-18 09:34:02 -0800962module_usb_driver(wdm_driver);
Oliver Neukumafba9372008-05-13 17:01:25 +0200963
964MODULE_AUTHOR(DRIVER_AUTHOR);
Oliver Neukum87d65e52008-06-19 14:20:18 +0200965MODULE_DESCRIPTION(DRIVER_DESC);
Oliver Neukumafba9372008-05-13 17:01:25 +0200966MODULE_LICENSE("GPL");