diff options
Diffstat (limited to 'drivers/usb/host/ehci-sched.c')
-rw-r--r-- | drivers/usb/host/ehci-sched.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index ebcca9700671..5871944e6145 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -707,6 +707,7 @@ iso_stream_init ( | |||
707 | } else { | 707 | } else { |
708 | u32 addr; | 708 | u32 addr; |
709 | int think_time; | 709 | int think_time; |
710 | int hs_transfers; | ||
710 | 711 | ||
711 | addr = dev->ttport << 24; | 712 | addr = dev->ttport << 24; |
712 | if (!ehci_is_TDI(ehci) | 713 | if (!ehci_is_TDI(ehci) |
@@ -719,6 +720,7 @@ iso_stream_init ( | |||
719 | think_time = dev->tt ? dev->tt->think_time : 0; | 720 | think_time = dev->tt ? dev->tt->think_time : 0; |
720 | stream->tt_usecs = NS_TO_US (think_time + usb_calc_bus_time ( | 721 | stream->tt_usecs = NS_TO_US (think_time + usb_calc_bus_time ( |
721 | dev->speed, is_input, 1, maxp)); | 722 | dev->speed, is_input, 1, maxp)); |
723 | hs_transfers = max (1u, (maxp + 187) / 188); | ||
722 | if (is_input) { | 724 | if (is_input) { |
723 | u32 tmp; | 725 | u32 tmp; |
724 | 726 | ||
@@ -727,12 +729,11 @@ iso_stream_init ( | |||
727 | stream->usecs = HS_USECS_ISO (1); | 729 | stream->usecs = HS_USECS_ISO (1); |
728 | stream->raw_mask = 1; | 730 | stream->raw_mask = 1; |
729 | 731 | ||
730 | /* pessimistic c-mask */ | 732 | /* c-mask as specified in USB 2.0 11.18.4 3.c */ |
731 | tmp = usb_calc_bus_time (USB_SPEED_FULL, 1, 0, maxp) | 733 | tmp = (1 << (hs_transfers + 2)) - 1; |
732 | / (125 * 1000); | 734 | stream->raw_mask |= tmp << (8 + 2); |
733 | stream->raw_mask |= 3 << (tmp + 9); | ||
734 | } else | 735 | } else |
735 | stream->raw_mask = smask_out [maxp / 188]; | 736 | stream->raw_mask = smask_out [hs_transfers - 1]; |
736 | bandwidth = stream->usecs + stream->c_usecs; | 737 | bandwidth = stream->usecs + stream->c_usecs; |
737 | bandwidth /= 1 << (interval + 2); | 738 | bandwidth /= 1 << (interval + 2); |
738 | 739 | ||
@@ -863,9 +864,8 @@ iso_sched_alloc (unsigned packets, gfp_t mem_flags) | |||
863 | int size = sizeof *iso_sched; | 864 | int size = sizeof *iso_sched; |
864 | 865 | ||
865 | size += packets * sizeof (struct ehci_iso_packet); | 866 | size += packets * sizeof (struct ehci_iso_packet); |
866 | iso_sched = kmalloc (size, mem_flags); | 867 | iso_sched = kzalloc(size, mem_flags); |
867 | if (likely (iso_sched != NULL)) { | 868 | if (likely (iso_sched != NULL)) { |
868 | memset(iso_sched, 0, size); | ||
869 | INIT_LIST_HEAD (&iso_sched->td_list); | 869 | INIT_LIST_HEAD (&iso_sched->td_list); |
870 | } | 870 | } |
871 | return iso_sched; | 871 | return iso_sched; |
@@ -1398,7 +1398,7 @@ itd_complete ( | |||
1398 | */ | 1398 | */ |
1399 | 1399 | ||
1400 | /* give urb back to the driver ... can be out-of-order */ | 1400 | /* give urb back to the driver ... can be out-of-order */ |
1401 | dev = usb_get_dev (urb->dev); | 1401 | dev = urb->dev; |
1402 | ehci_urb_done (ehci, urb, regs); | 1402 | ehci_urb_done (ehci, urb, regs); |
1403 | urb = NULL; | 1403 | urb = NULL; |
1404 | 1404 | ||
@@ -1417,7 +1417,6 @@ itd_complete ( | |||
1417 | (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); | 1417 | (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); |
1418 | } | 1418 | } |
1419 | iso_stream_put (ehci, stream); | 1419 | iso_stream_put (ehci, stream); |
1420 | usb_put_dev (dev); | ||
1421 | 1420 | ||
1422 | return 1; | 1421 | return 1; |
1423 | } | 1422 | } |
@@ -1764,7 +1763,7 @@ sitd_complete ( | |||
1764 | */ | 1763 | */ |
1765 | 1764 | ||
1766 | /* give urb back to the driver */ | 1765 | /* give urb back to the driver */ |
1767 | dev = usb_get_dev (urb->dev); | 1766 | dev = urb->dev; |
1768 | ehci_urb_done (ehci, urb, regs); | 1767 | ehci_urb_done (ehci, urb, regs); |
1769 | urb = NULL; | 1768 | urb = NULL; |
1770 | 1769 | ||
@@ -1783,7 +1782,6 @@ sitd_complete ( | |||
1783 | (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); | 1782 | (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); |
1784 | } | 1783 | } |
1785 | iso_stream_put (ehci, stream); | 1784 | iso_stream_put (ehci, stream); |
1786 | usb_put_dev (dev); | ||
1787 | 1785 | ||
1788 | return 1; | 1786 | return 1; |
1789 | } | 1787 | } |