diff options
Diffstat (limited to 'drivers/usb/host/ehci-sched.c')
-rw-r--r-- | drivers/usb/host/ehci-sched.c | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 8a8e08a51ba3..be575e46eac3 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -440,11 +440,10 @@ static int enable_periodic (struct ehci_hcd *ehci) | |||
440 | /* did clearing PSE did take effect yet? | 440 | /* did clearing PSE did take effect yet? |
441 | * takes effect only at frame boundaries... | 441 | * takes effect only at frame boundaries... |
442 | */ | 442 | */ |
443 | status = handshake(ehci, &ehci->regs->status, STS_PSS, 0, 9 * 125); | 443 | status = handshake_on_error_set_halt(ehci, &ehci->regs->status, |
444 | if (status != 0) { | 444 | STS_PSS, 0, 9 * 125); |
445 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | 445 | if (status) |
446 | return status; | 446 | return status; |
447 | } | ||
448 | 447 | ||
449 | cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; | 448 | cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; |
450 | ehci_writel(ehci, cmd, &ehci->regs->command); | 449 | ehci_writel(ehci, cmd, &ehci->regs->command); |
@@ -465,11 +464,10 @@ static int disable_periodic (struct ehci_hcd *ehci) | |||
465 | /* did setting PSE not take effect yet? | 464 | /* did setting PSE not take effect yet? |
466 | * takes effect only at frame boundaries... | 465 | * takes effect only at frame boundaries... |
467 | */ | 466 | */ |
468 | status = handshake(ehci, &ehci->regs->status, STS_PSS, STS_PSS, 9 * 125); | 467 | status = handshake_on_error_set_halt(ehci, &ehci->regs->status, |
469 | if (status != 0) { | 468 | STS_PSS, STS_PSS, 9 * 125); |
470 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | 469 | if (status) |
471 | return status; | 470 | return status; |
472 | } | ||
473 | 471 | ||
474 | cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE; | 472 | cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE; |
475 | ehci_writel(ehci, cmd, &ehci->regs->command); | 473 | ehci_writel(ehci, cmd, &ehci->regs->command); |
@@ -1183,21 +1181,18 @@ itd_urb_transaction ( | |||
1183 | struct ehci_itd, itd_list); | 1181 | struct ehci_itd, itd_list); |
1184 | list_del (&itd->itd_list); | 1182 | list_del (&itd->itd_list); |
1185 | itd_dma = itd->itd_dma; | 1183 | itd_dma = itd->itd_dma; |
1186 | } else | 1184 | } else { |
1187 | itd = NULL; | ||
1188 | |||
1189 | if (!itd) { | ||
1190 | spin_unlock_irqrestore (&ehci->lock, flags); | 1185 | spin_unlock_irqrestore (&ehci->lock, flags); |
1191 | itd = dma_pool_alloc (ehci->itd_pool, mem_flags, | 1186 | itd = dma_pool_alloc (ehci->itd_pool, mem_flags, |
1192 | &itd_dma); | 1187 | &itd_dma); |
1193 | spin_lock_irqsave (&ehci->lock, flags); | 1188 | spin_lock_irqsave (&ehci->lock, flags); |
1189 | if (!itd) { | ||
1190 | iso_sched_free(stream, sched); | ||
1191 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
1192 | return -ENOMEM; | ||
1193 | } | ||
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | if (unlikely (NULL == itd)) { | ||
1197 | iso_sched_free (stream, sched); | ||
1198 | spin_unlock_irqrestore (&ehci->lock, flags); | ||
1199 | return -ENOMEM; | ||
1200 | } | ||
1201 | memset (itd, 0, sizeof *itd); | 1196 | memset (itd, 0, sizeof *itd); |
1202 | itd->itd_dma = itd_dma; | 1197 | itd->itd_dma = itd_dma; |
1203 | list_add (&itd->itd_list, &sched->td_list); | 1198 | list_add (&itd->itd_list, &sched->td_list); |
@@ -1682,7 +1677,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, | |||
1682 | #ifdef EHCI_URB_TRACE | 1677 | #ifdef EHCI_URB_TRACE |
1683 | ehci_dbg (ehci, | 1678 | ehci_dbg (ehci, |
1684 | "%s %s urb %p ep%d%s len %d, %d pkts %d uframes [%p]\n", | 1679 | "%s %s urb %p ep%d%s len %d, %d pkts %d uframes [%p]\n", |
1685 | __FUNCTION__, urb->dev->devpath, urb, | 1680 | __func__, urb->dev->devpath, urb, |
1686 | usb_pipeendpoint (urb->pipe), | 1681 | usb_pipeendpoint (urb->pipe), |
1687 | usb_pipein (urb->pipe) ? "in" : "out", | 1682 | usb_pipein (urb->pipe) ? "in" : "out", |
1688 | urb->transfer_buffer_length, | 1683 | urb->transfer_buffer_length, |
@@ -1816,21 +1811,18 @@ sitd_urb_transaction ( | |||
1816 | struct ehci_sitd, sitd_list); | 1811 | struct ehci_sitd, sitd_list); |
1817 | list_del (&sitd->sitd_list); | 1812 | list_del (&sitd->sitd_list); |
1818 | sitd_dma = sitd->sitd_dma; | 1813 | sitd_dma = sitd->sitd_dma; |
1819 | } else | 1814 | } else { |
1820 | sitd = NULL; | ||
1821 | |||
1822 | if (!sitd) { | ||
1823 | spin_unlock_irqrestore (&ehci->lock, flags); | 1815 | spin_unlock_irqrestore (&ehci->lock, flags); |
1824 | sitd = dma_pool_alloc (ehci->sitd_pool, mem_flags, | 1816 | sitd = dma_pool_alloc (ehci->sitd_pool, mem_flags, |
1825 | &sitd_dma); | 1817 | &sitd_dma); |
1826 | spin_lock_irqsave (&ehci->lock, flags); | 1818 | spin_lock_irqsave (&ehci->lock, flags); |
1819 | if (!sitd) { | ||
1820 | iso_sched_free(stream, iso_sched); | ||
1821 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
1822 | return -ENOMEM; | ||
1823 | } | ||
1827 | } | 1824 | } |
1828 | 1825 | ||
1829 | if (!sitd) { | ||
1830 | iso_sched_free (stream, iso_sched); | ||
1831 | spin_unlock_irqrestore (&ehci->lock, flags); | ||
1832 | return -ENOMEM; | ||
1833 | } | ||
1834 | memset (sitd, 0, sizeof *sitd); | 1826 | memset (sitd, 0, sizeof *sitd); |
1835 | sitd->sitd_dma = sitd_dma; | 1827 | sitd->sitd_dma = sitd_dma; |
1836 | list_add (&sitd->sitd_list, &iso_sched->td_list); | 1828 | list_add (&sitd->sitd_list, &iso_sched->td_list); |