aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2014-11-27 11:19:14 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-12-02 19:14:29 -0500
commit69defe04ec825e42e0d719cca5a23f48b624bee9 (patch)
treef07dc19714d480df457c718cb2f5af1cb4717aaf
parentc00552ebafddfe6abb397d957004f165e010abd2 (diff)
xhci: cleanup finish_td function
Remove unnecessary else after return, dropping extra indentation depth. No functional changes. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-ring.c105
1 files changed, 49 insertions, 56 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 06433aec81d7..5f609325ec7b 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1813,72 +1813,65 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td,
1813 if (skip) 1813 if (skip)
1814 goto td_cleanup; 1814 goto td_cleanup;
1815 1815
1816 if (trb_comp_code == COMP_STOP_INVAL || 1816 if (trb_comp_code == COMP_STOP_INVAL || trb_comp_code == COMP_STOP) {
1817 trb_comp_code == COMP_STOP) {
1818 /* The Endpoint Stop Command completion will take care of any 1817 /* The Endpoint Stop Command completion will take care of any
1819 * stopped TDs. A stopped TD may be restarted, so don't update 1818 * stopped TDs. A stopped TD may be restarted, so don't update
1820 * the ring dequeue pointer or take this TD off any lists yet. 1819 * the ring dequeue pointer or take this TD off any lists yet.
1821 */ 1820 */
1822 ep->stopped_td = td; 1821 ep->stopped_td = td;
1823 return 0; 1822 return 0;
1823 }
1824 if (trb_comp_code == COMP_STALL ||
1825 xhci_requires_manual_halt_cleanup(xhci, ep_ctx,
1826 trb_comp_code)) {
1827 /* Issue a reset endpoint command to clear the host side
1828 * halt, followed by a set dequeue command to move the
1829 * dequeue pointer past the TD.
1830 * The class driver clears the device side halt later.
1831 */
1832 xhci_cleanup_halted_endpoint(xhci, slot_id, ep_index,
1833 ep_ring->stream_id, td, event_trb);
1824 } else { 1834 } else {
1825 if (trb_comp_code == COMP_STALL || 1835 /* Update ring dequeue pointer */
1826 xhci_requires_manual_halt_cleanup(xhci, ep_ctx, 1836 while (ep_ring->dequeue != td->last_trb)
1827 trb_comp_code)) {
1828 /* Issue a reset endpoint command to clear the host side
1829 * halt, followed by a set dequeue command to move the
1830 * dequeue pointer past the TD.
1831 * The class driver clears the device side halt later.
1832 */
1833 xhci_cleanup_halted_endpoint(xhci,
1834 slot_id, ep_index, ep_ring->stream_id,
1835 td, event_trb);
1836 } else {
1837 /* Update ring dequeue pointer */
1838 while (ep_ring->dequeue != td->last_trb)
1839 inc_deq(xhci, ep_ring);
1840 inc_deq(xhci, ep_ring); 1837 inc_deq(xhci, ep_ring);
1841 } 1838 inc_deq(xhci, ep_ring);
1839 }
1842 1840
1843td_cleanup: 1841td_cleanup:
1844 /* Clean up the endpoint's TD list */ 1842 /* Clean up the endpoint's TD list */
1845 urb = td->urb; 1843 urb = td->urb;
1846 urb_priv = urb->hcpriv; 1844 urb_priv = urb->hcpriv;
1847 1845
1848 /* Do one last check of the actual transfer length. 1846 /* Do one last check of the actual transfer length.
1849 * If the host controller said we transferred more data than 1847 * If the host controller said we transferred more data than the buffer
1850 * the buffer length, urb->actual_length will be a very big 1848 * length, urb->actual_length will be a very big number (since it's
1851 * number (since it's unsigned). Play it safe and say we didn't 1849 * unsigned). Play it safe and say we didn't transfer anything.
1852 * transfer anything. 1850 */
1853 */ 1851 if (urb->actual_length > urb->transfer_buffer_length) {
1854 if (urb->actual_length > urb->transfer_buffer_length) { 1852 xhci_warn(xhci, "URB transfer length is wrong, xHC issue? req. len = %u, act. len = %u\n",
1855 xhci_warn(xhci, "URB transfer length is wrong, " 1853 urb->transfer_buffer_length,
1856 "xHC issue? req. len = %u, " 1854 urb->actual_length);
1857 "act. len = %u\n", 1855 urb->actual_length = 0;
1858 urb->transfer_buffer_length, 1856 if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
1859 urb->actual_length); 1857 *status = -EREMOTEIO;
1860 urb->actual_length = 0; 1858 else
1861 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) 1859 *status = 0;
1862 *status = -EREMOTEIO; 1860 }
1863 else 1861 list_del_init(&td->td_list);
1864 *status = 0; 1862 /* Was this TD slated to be cancelled but completed anyway? */
1865 } 1863 if (!list_empty(&td->cancelled_td_list))
1866 list_del_init(&td->td_list); 1864 list_del_init(&td->cancelled_td_list);
1867 /* Was this TD slated to be cancelled but completed anyway? */ 1865
1868 if (!list_empty(&td->cancelled_td_list)) 1866 urb_priv->td_cnt++;
1869 list_del_init(&td->cancelled_td_list); 1867 /* Giveback the urb when all the tds are completed */
1870 1868 if (urb_priv->td_cnt == urb_priv->length) {
1871 urb_priv->td_cnt++; 1869 ret = 1;
1872 /* Giveback the urb when all the tds are completed */ 1870 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
1873 if (urb_priv->td_cnt == urb_priv->length) { 1871 xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--;
1874 ret = 1; 1872 if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) {
1875 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { 1873 if (xhci->quirks & XHCI_AMD_PLL_FIX)
1876 xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--; 1874 usb_amd_quirk_pll_enable();
1877 if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs
1878 == 0) {
1879 if (xhci->quirks & XHCI_AMD_PLL_FIX)
1880 usb_amd_quirk_pll_enable();
1881 }
1882 } 1875 }
1883 } 1876 }
1884 } 1877 }