diff options
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/devio.c | 18 | ||||
-rw-r--r-- | drivers/usb/core/hcd.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/hcd.h | 8 | ||||
-rw-r--r-- | drivers/usb/core/message.c | 6 |
4 files changed, 23 insertions, 13 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 787c27a63c51..f86bf1454e21 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -569,8 +569,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
569 | free_page((unsigned long)tbuf); | 569 | free_page((unsigned long)tbuf); |
570 | return -EINVAL; | 570 | return -EINVAL; |
571 | } | 571 | } |
572 | snoop(&dev->dev, "control read: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", | 572 | snoop(&dev->dev, "control read: bRequest=%02x " |
573 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); | 573 | "bRrequestType=%02x wValue=%04x " |
574 | "wIndex=%04x wLength=%04x\n", | ||
575 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, | ||
576 | ctrl.wIndex, ctrl.wLength); | ||
574 | 577 | ||
575 | usb_unlock_device(dev); | 578 | usb_unlock_device(dev); |
576 | i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, | 579 | i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, |
@@ -579,11 +582,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
579 | if ((i > 0) && ctrl.wLength) { | 582 | if ((i > 0) && ctrl.wLength) { |
580 | if (usbfs_snoop) { | 583 | if (usbfs_snoop) { |
581 | dev_info(&dev->dev, "control read: data "); | 584 | dev_info(&dev->dev, "control read: data "); |
582 | for (j = 0; j < ctrl.wLength; ++j) | 585 | for (j = 0; j < i; ++j) |
583 | printk ("%02x ", (unsigned char)(tbuf)[j]); | 586 | printk ("%02x ", (unsigned char)(tbuf)[j]); |
584 | printk("\n"); | 587 | printk("\n"); |
585 | } | 588 | } |
586 | if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) { | 589 | if (copy_to_user(ctrl.data, tbuf, i)) { |
587 | free_page((unsigned long)tbuf); | 590 | free_page((unsigned long)tbuf); |
588 | return -EFAULT; | 591 | return -EFAULT; |
589 | } | 592 | } |
@@ -595,8 +598,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
595 | return -EFAULT; | 598 | return -EFAULT; |
596 | } | 599 | } |
597 | } | 600 | } |
598 | snoop(&dev->dev, "control write: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", | 601 | snoop(&dev->dev, "control write: bRequest=%02x " |
599 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); | 602 | "bRrequestType=%02x wValue=%04x " |
603 | "wIndex=%04x wLength=%04x\n", | ||
604 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, | ||
605 | ctrl.wIndex, ctrl.wLength); | ||
600 | if (usbfs_snoop) { | 606 | if (usbfs_snoop) { |
601 | dev_info(&dev->dev, "control write: data: "); | 607 | dev_info(&dev->dev, "control write: data: "); |
602 | for (j = 0; j < ctrl.wLength; ++j) | 608 | for (j = 0; j < ctrl.wLength; ++j) |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 8616356f55e8..79422a3b07bc 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -939,9 +939,9 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount) | |||
939 | case USB_SPEED_HIGH: /* ISOC or INTR */ | 939 | case USB_SPEED_HIGH: /* ISOC or INTR */ |
940 | // FIXME adjust for input vs output | 940 | // FIXME adjust for input vs output |
941 | if (isoc) | 941 | if (isoc) |
942 | tmp = HS_USECS (bytecount); | 942 | tmp = HS_NSECS_ISO (bytecount); |
943 | else | 943 | else |
944 | tmp = HS_USECS_ISO (bytecount); | 944 | tmp = HS_NSECS (bytecount); |
945 | return tmp; | 945 | return tmp; |
946 | default: | 946 | default: |
947 | pr_debug ("%s: bogus device speed!\n", usbcore_name); | 947 | pr_debug ("%s: bogus device speed!\n", usbcore_name); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 67db4a999b93..28055f95645b 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -334,17 +334,19 @@ extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, | |||
334 | extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); | 334 | extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); |
335 | 335 | ||
336 | /* | 336 | /* |
337 | * Ceiling microseconds (typical) for that many bytes at high speed | 337 | * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed |
338 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed | 338 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed |
339 | * to preallocate bandwidth) | 339 | * to preallocate bandwidth) |
340 | */ | 340 | */ |
341 | #define USB2_HOST_DELAY 5 /* nsec, guess */ | 341 | #define USB2_HOST_DELAY 5 /* nsec, guess */ |
342 | #define HS_USECS(bytes) NS_TO_US ( ((55 * 8 * 2083)/1000) \ | 342 | #define HS_NSECS(bytes) ( ((55 * 8 * 2083)/1000) \ |
343 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ | 343 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ |
344 | + USB2_HOST_DELAY) | 344 | + USB2_HOST_DELAY) |
345 | #define HS_USECS_ISO(bytes) NS_TO_US ( ((38 * 8 * 2083)/1000) \ | 345 | #define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083)/1000) \ |
346 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ | 346 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ |
347 | + USB2_HOST_DELAY) | 347 | + USB2_HOST_DELAY) |
348 | #define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes)) | ||
349 | #define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes)) | ||
348 | 350 | ||
349 | extern long usb_calc_bus_time (int speed, int is_input, | 351 | extern long usb_calc_bus_time (int speed, int is_input, |
350 | int isoc, int bytecount); | 352 | int isoc, int bytecount); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index a428ef479bd7..88d1b376f67c 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -985,8 +985,10 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
985 | for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { | 985 | for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { |
986 | struct usb_interface *interface; | 986 | struct usb_interface *interface; |
987 | 987 | ||
988 | /* remove this interface */ | 988 | /* remove this interface if it has been registered */ |
989 | interface = dev->actconfig->interface[i]; | 989 | interface = dev->actconfig->interface[i]; |
990 | if (!klist_node_attached(&interface->dev.knode_bus)) | ||
991 | continue; | ||
990 | dev_dbg (&dev->dev, "unregistering interface %s\n", | 992 | dev_dbg (&dev->dev, "unregistering interface %s\n", |
991 | interface->dev.bus_id); | 993 | interface->dev.bus_id); |
992 | usb_remove_sysfs_intf_files(interface); | 994 | usb_remove_sysfs_intf_files(interface); |
@@ -1439,7 +1441,7 @@ free_interfaces: | |||
1439 | } | 1441 | } |
1440 | } | 1442 | } |
1441 | 1443 | ||
1442 | return ret; | 1444 | return 0; |
1443 | } | 1445 | } |
1444 | 1446 | ||
1445 | // synchronous request completion model | 1447 | // synchronous request completion model |