diff options
author | Oliver Neukum <oliver@neukum.org> | 2008-06-19 08:20:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-21 18:16:31 -0400 |
commit | 87d65e54b6d5ff6ee905c4ade1e28f486ccfce8a (patch) | |
tree | a3e3a0f31d8fe0cd03bb79262a4a91ce012c8fa2 /drivers/usb | |
parent | 640c1bce86d1e11ee6a1263fdf6170d3210b1684 (diff) |
USB: cdc-wdm cleanup
- fixes an error with filling out control requests
- increases grepability and error logging
- fixes the short read code path
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/class/cdc-wdm.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 731db051070a..3a656f8f9935 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -28,8 +28,9 @@ | |||
28 | /* | 28 | /* |
29 | * Version Information | 29 | * Version Information |
30 | */ | 30 | */ |
31 | #define DRIVER_VERSION "v0.02" | 31 | #define DRIVER_VERSION "v0.03" |
32 | #define DRIVER_AUTHOR "Oliver Neukum" | 32 | #define DRIVER_AUTHOR "Oliver Neukum" |
33 | #define DRIVER_DESC "USB Abstract Control Model driver for USB WCM Device Management" | ||
33 | 34 | ||
34 | static struct usb_device_id wdm_ids[] = { | 35 | static struct usb_device_id wdm_ids[] = { |
35 | { | 36 | { |
@@ -205,7 +206,7 @@ static void wdm_int_callback(struct urb *urb) | |||
205 | req->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; | 206 | req->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; |
206 | req->wValue = 0; | 207 | req->wValue = 0; |
207 | req->wIndex = desc->inum; | 208 | req->wIndex = desc->inum; |
208 | req->wLength = cpu_to_le16(desc->bMaxPacketSize0); | 209 | req->wLength = cpu_to_le16(desc->wMaxCommand); |
209 | 210 | ||
210 | usb_fill_control_urb( | 211 | usb_fill_control_urb( |
211 | desc->response, | 212 | desc->response, |
@@ -214,7 +215,7 @@ static void wdm_int_callback(struct urb *urb) | |||
214 | usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), | 215 | usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), |
215 | (unsigned char *)req, | 216 | (unsigned char *)req, |
216 | desc->inbuf, | 217 | desc->inbuf, |
217 | desc->bMaxPacketSize0, | 218 | desc->wMaxCommand, |
218 | wdm_in_callback, | 219 | wdm_in_callback, |
219 | desc | 220 | desc |
220 | ); | 221 | ); |
@@ -266,7 +267,7 @@ static void cleanup(struct wdm_device *desc) | |||
266 | desc->sbuf, | 267 | desc->sbuf, |
267 | desc->validity->transfer_dma); | 268 | desc->validity->transfer_dma); |
268 | usb_buffer_free(interface_to_usbdev(desc->intf), | 269 | usb_buffer_free(interface_to_usbdev(desc->intf), |
269 | desc->wMaxPacketSize, | 270 | desc->wMaxCommand, |
270 | desc->inbuf, | 271 | desc->inbuf, |
271 | desc->response->transfer_dma); | 272 | desc->response->transfer_dma); |
272 | kfree(desc->orq); | 273 | kfree(desc->orq); |
@@ -347,6 +348,7 @@ static ssize_t wdm_write | |||
347 | if (rv < 0) { | 348 | if (rv < 0) { |
348 | kfree(buf); | 349 | kfree(buf); |
349 | clear_bit(WDM_IN_USE, &desc->flags); | 350 | clear_bit(WDM_IN_USE, &desc->flags); |
351 | err("Tx URB error: %d", rv); | ||
350 | } else { | 352 | } else { |
351 | dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d", | 353 | dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d", |
352 | req->wIndex); | 354 | req->wIndex); |
@@ -418,6 +420,9 @@ retry: | |||
418 | desc->ubuf[i] = desc->ubuf[i + cntr]; | 420 | desc->ubuf[i] = desc->ubuf[i + cntr]; |
419 | 421 | ||
420 | desc->length -= cntr; | 422 | desc->length -= cntr; |
423 | /* in case we had outstanding data */ | ||
424 | if (!desc->length) | ||
425 | clear_bit(WDM_READ, &desc->flags); | ||
421 | rv = cntr; | 426 | rv = cntr; |
422 | 427 | ||
423 | err: | 428 | err: |
@@ -735,6 +740,5 @@ module_init(wdm_init); | |||
735 | module_exit(wdm_exit); | 740 | module_exit(wdm_exit); |
736 | 741 | ||
737 | MODULE_AUTHOR(DRIVER_AUTHOR); | 742 | MODULE_AUTHOR(DRIVER_AUTHOR); |
738 | MODULE_DESCRIPTION("USB Abstract Control Model driver for " | 743 | MODULE_DESCRIPTION(DRIVER_DESC); |
739 | "USB WCM Device Management"); | ||
740 | MODULE_LICENSE("GPL"); | 744 | MODULE_LICENSE("GPL"); |