diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-03 11:48:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-03 11:48:58 -0500 |
commit | 7f5b09c15ab989ed5ce4adda0be42c1302df70b7 (patch) | |
tree | 9695b00983d1bd077ff91c463abcb136330cf344 /drivers/usb/core/urb.c | |
parent | 94468080220162f74dc6ce5c3e95e5fec8022902 (diff) | |
parent | cedf8a78421943441b9011ce7bcdab55f07d2ea6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (220 commits)
USB: backlight, appledisplay: fix incomplete registration failure handling
USB: pl2303: remove unnecessary reset of usb_device in urbs
USB: ftdi_sio: remove obsolete check in unthrottle
USB: ftdi_sio: remove unused tx_bytes counter
USB: qcaux: driver for auxiliary serial ports on Qualcomm devices
USB: pl2303: initial TIOCGSERIAL support
USB: option: add Longcheer/Longsung vendor ID
USB: fix I2C API usage in ohci-pnx4008.
USB: usbmon: mask seconds properly in text API
USB: sisusbvga: no unnecessary GFP_ATOMIC
USB: storage: onetouch: unnecessary GFP_ATOMIC
USB: serial: ftdi: add CONTEC vendor and product id
USB: remove references to port->port.count from the serial drivers
USB: tty: Prune uses of tty_request_room in the USB layer
USB: tty: Add a function to insert a string of characters with the same flag
USB: don't read past config->interface[] if usb_control_msg() fails in usb_reset_configuration()
USB: tty: kill request_room for USB ACM class
USB: tty: sort out the request_room handling for whiteheat
USB: storage: fix misplaced parenthesis
USB: vstusb.c: removal of driver for Vernier Software & Technology, Inc., devices and spectrometers
...
Diffstat (limited to 'drivers/usb/core/urb.c')
-rw-r--r-- | drivers/usb/core/urb.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index e7cae1334693..27080561a1c2 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -387,6 +387,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
387 | { | 387 | { |
388 | unsigned int orig_flags = urb->transfer_flags; | 388 | unsigned int orig_flags = urb->transfer_flags; |
389 | unsigned int allowed; | 389 | unsigned int allowed; |
390 | static int pipetypes[4] = { | ||
391 | PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT | ||
392 | }; | ||
393 | |||
394 | /* Check that the pipe's type matches the endpoint's type */ | ||
395 | if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) | ||
396 | return -EPIPE; /* The most suitable error code :-) */ | ||
390 | 397 | ||
391 | /* enforce simple/standard policy */ | 398 | /* enforce simple/standard policy */ |
392 | allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | | 399 | allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | |
@@ -430,7 +437,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
430 | case USB_ENDPOINT_XFER_INT: | 437 | case USB_ENDPOINT_XFER_INT: |
431 | /* too small? */ | 438 | /* too small? */ |
432 | switch (dev->speed) { | 439 | switch (dev->speed) { |
433 | case USB_SPEED_VARIABLE: | 440 | case USB_SPEED_WIRELESS: |
434 | if (urb->interval < 6) | 441 | if (urb->interval < 6) |
435 | return -EINVAL; | 442 | return -EINVAL; |
436 | break; | 443 | break; |
@@ -446,7 +453,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
446 | if (urb->interval > (1 << 15)) | 453 | if (urb->interval > (1 << 15)) |
447 | return -EINVAL; | 454 | return -EINVAL; |
448 | max = 1 << 15; | 455 | max = 1 << 15; |
449 | case USB_SPEED_VARIABLE: | 456 | case USB_SPEED_WIRELESS: |
450 | if (urb->interval > 16) | 457 | if (urb->interval > 16) |
451 | return -EINVAL; | 458 | return -EINVAL; |
452 | break; | 459 | break; |
@@ -473,7 +480,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
473 | default: | 480 | default: |
474 | return -EINVAL; | 481 | return -EINVAL; |
475 | } | 482 | } |
476 | if (dev->speed != USB_SPEED_VARIABLE) { | 483 | if (dev->speed != USB_SPEED_WIRELESS) { |
477 | /* Round down to a power of 2, no more than max */ | 484 | /* Round down to a power of 2, no more than max */ |
478 | urb->interval = min(max, 1 << ilog2(urb->interval)); | 485 | urb->interval = min(max, 1 << ilog2(urb->interval)); |
479 | } | 486 | } |