aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ehci-sched.c')
-rw-r--r--drivers/usb/host/ehci-sched.c47
1 files changed, 12 insertions, 35 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 1a94e6cec41..001b2c389be 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1630,16 +1630,12 @@ itd_complete (
1630 BUG_ON (itd->urb == urb); 1630 BUG_ON (itd->urb == urb);
1631 */ 1631 */
1632 1632
1633 /* give urb back to the driver ... can be out-of-order */ 1633 /* give urb back to the driver; completion often (re)submits */
1634 dev = urb->dev; 1634 dev = urb->dev;
1635 ehci_urb_done(ehci, urb, 0); 1635 ehci_urb_done(ehci, urb, 0);
1636 retval = true; 1636 retval = true;
1637 urb = NULL; 1637 urb = NULL;
1638
1639 /* defer stopping schedule; completion can submit */
1640 ehci->periodic_sched--; 1638 ehci->periodic_sched--;
1641 if (unlikely (!ehci->periodic_sched))
1642 (void) disable_periodic (ehci);
1643 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 1639 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
1644 1640
1645 if (unlikely (list_empty (&stream->td_list))) { 1641 if (unlikely (list_empty (&stream->td_list))) {
@@ -1725,8 +1721,6 @@ done:
1725 return status; 1721 return status;
1726} 1722}
1727 1723
1728#ifdef CONFIG_USB_EHCI_SPLIT_ISO
1729
1730/*-------------------------------------------------------------------------*/ 1724/*-------------------------------------------------------------------------*/
1731 1725
1732/* 1726/*
@@ -2016,16 +2010,12 @@ sitd_complete (
2016 BUG_ON (sitd->urb == urb); 2010 BUG_ON (sitd->urb == urb);
2017 */ 2011 */
2018 2012
2019 /* give urb back to the driver */ 2013 /* give urb back to the driver; completion often (re)submits */
2020 dev = urb->dev; 2014 dev = urb->dev;
2021 ehci_urb_done(ehci, urb, 0); 2015 ehci_urb_done(ehci, urb, 0);
2022 retval = true; 2016 retval = true;
2023 urb = NULL; 2017 urb = NULL;
2024
2025 /* defer stopping schedule; completion can submit */
2026 ehci->periodic_sched--; 2018 ehci->periodic_sched--;
2027 if (!ehci->periodic_sched)
2028 (void) disable_periodic (ehci);
2029 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 2019 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
2030 2020
2031 if (list_empty (&stream->td_list)) { 2021 if (list_empty (&stream->td_list)) {
@@ -2108,26 +2098,6 @@ done:
2108 return status; 2098 return status;
2109} 2099}
2110 2100
2111#else
2112
2113static inline int
2114sitd_submit (struct ehci_hcd *ehci, struct urb *urb, gfp_t mem_flags)
2115{
2116 ehci_dbg (ehci, "split iso support is disabled\n");
2117 return -ENOSYS;
2118}
2119
2120static inline unsigned
2121sitd_complete (
2122 struct ehci_hcd *ehci,
2123 struct ehci_sitd *sitd
2124) {
2125 ehci_err (ehci, "sitd_complete %p?\n", sitd);
2126 return 0;
2127}
2128
2129#endif /* USB_EHCI_SPLIT_ISO */
2130
2131/*-------------------------------------------------------------------------*/ 2101/*-------------------------------------------------------------------------*/
2132 2102
2133static void 2103static void
@@ -2252,8 +2222,14 @@ restart:
2252 } 2222 }
2253 2223
2254 /* assume completion callbacks modify the queue */ 2224 /* assume completion callbacks modify the queue */
2255 if (unlikely (modified)) 2225 if (unlikely (modified)) {
2256 goto restart; 2226 if (likely(ehci->periodic_sched > 0))
2227 goto restart;
2228 /* maybe we can short-circuit this scan! */
2229 disable_periodic(ehci);
2230 now_uframe = clock;
2231 break;
2232 }
2257 } 2233 }
2258 2234
2259 /* stop when we catch up to the HC */ 2235 /* stop when we catch up to the HC */
@@ -2269,7 +2245,8 @@ restart:
2269 if (now_uframe == clock) { 2245 if (now_uframe == clock) {
2270 unsigned now; 2246 unsigned now;
2271 2247
2272 if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) 2248 if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state)
2249 || ehci->periodic_sched == 0)
2273 break; 2250 break;
2274 ehci->next_uframe = now_uframe; 2251 ehci->next_uframe = now_uframe;
2275 now = ehci_readl(ehci, &ehci->regs->frame_index) % mod; 2252 now = ehci_readl(ehci, &ehci->regs->frame_index) % mod;