mfd: Rename twl5031 sih modules
[safe/jmp/linux-2.6] / drivers / usb / host / xhci.c
index 2e370fe..40e0a0c 100644 (file)
@@ -353,11 +353,7 @@ void xhci_event_ring_work(unsigned long arg)
                if (!xhci->devs[i])
                        continue;
                for (j = 0; j < 31; ++j) {
-                       struct xhci_ring *ring = xhci->devs[i]->eps[j].ring;
-                       if (!ring)
-                               continue;
-                       xhci_dbg(xhci, "Dev %d endpoint ring %d:\n", i, j);
-                       xhci_debug_segment(xhci, ring->deq_seg);
+                       xhci_dbg_ep_rings(xhci, i, j, &xhci->devs[i]->eps[j]);
                }
        }
 
@@ -839,7 +835,12 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
        xhci_debug_ring(xhci, xhci->event_ring);
        ep_index = xhci_get_endpoint_index(&urb->ep->desc);
        ep = &xhci->devs[urb->dev->slot_id]->eps[ep_index];
-       ep_ring = ep->ring;
+       ep_ring = xhci_urb_to_transfer_ring(xhci, urb);
+       if (!ep_ring) {
+               ret = -EINVAL;
+               goto done;
+       }
+
        xhci_dbg(xhci, "Endpoint ring:\n");
        xhci_debug_ring(xhci, ep_ring);
        td = (struct xhci_td *) urb->hcpriv;
@@ -1383,7 +1384,7 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
         * or it will attempt to resend it on the next doorbell ring.
         */
        xhci_find_new_dequeue_state(xhci, udev->slot_id,
-                       ep_index, ep->stopped_td,
+                       ep_index, ep->stopped_stream, ep->stopped_td,
                        &deq_state);
 
        /* HW with the reset endpoint quirk will use the saved dequeue state to
@@ -1392,10 +1393,12 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
        if (!(xhci->quirks & XHCI_RESET_EP_QUIRK)) {
                xhci_dbg(xhci, "Queueing new dequeue state\n");
                xhci_queue_new_dequeue_state(xhci, udev->slot_id,
-                               ep_index, &deq_state);
+                               ep_index, ep->stopped_stream, &deq_state);
        } else {
                /* Better hope no one uses the input context between now and the
                 * reset endpoint completion!
+                * XXX: No idea how this hardware will react when stream rings
+                * are enabled.
                 */
                xhci_dbg(xhci, "Setting up input context for "
                                "configure endpoint command\n");
@@ -1454,6 +1457,7 @@ void xhci_endpoint_reset(struct usb_hcd *hcd,
        }
        virt_ep->stopped_td = NULL;
        virt_ep->stopped_trb = NULL;
+       virt_ep->stopped_stream = 0;
        spin_unlock_irqrestore(&xhci->lock, flags);
 
        if (ret)
@@ -1473,13 +1477,7 @@ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
        ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, __func__);
        if (ret <= 0)
                return -EINVAL;
-       if (!ep->ss_ep_comp) {
-               xhci_warn(xhci, "WARN: No SuperSpeed Endpoint Companion"
-                               " descriptor for ep 0x%x\n",
-                               ep->desc.bEndpointAddress);
-               return -EINVAL;
-       }
-       if (ep->ss_ep_comp->desc.bmAttributes == 0) {
+       if (ep->ss_ep_comp.bmAttributes == 0) {
                xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion"
                                " descriptor for ep 0x%x does not support streams\n",
                                ep->desc.bEndpointAddress);
@@ -1537,7 +1535,6 @@ static int xhci_calculate_streams_and_bitmask(struct xhci_hcd *xhci,
                struct usb_host_endpoint **eps, unsigned int num_eps,
                unsigned int *num_streams, u32 *changed_ep_bitmask)
 {
-       struct usb_host_ss_ep_comp *ss_ep_comp;
        unsigned int max_streams;
        unsigned int endpoint_flag;
        int i;
@@ -1549,8 +1546,8 @@ static int xhci_calculate_streams_and_bitmask(struct xhci_hcd *xhci,
                if (ret < 0)
                        return ret;
 
-               ss_ep_comp = eps[i]->ss_ep_comp;
-               max_streams = USB_SS_MAX_STREAMS(ss_ep_comp->desc.bmAttributes);
+               max_streams = USB_SS_MAX_STREAMS(
+                               eps[i]->ss_ep_comp.bmAttributes);
                if (max_streams < (*num_streams - 1)) {
                        xhci_dbg(xhci, "Ep 0x%x only supports %u stream IDs.\n",
                                        eps[i]->desc.bEndpointAddress,
@@ -1750,6 +1747,7 @@ cleanup:
        for (i = 0; i < num_eps; i++) {
                ep_index = xhci_get_endpoint_index(&eps[i]->desc);
                xhci_free_stream_info(xhci, vdev->eps[ep_index].stream_info);
+               vdev->eps[ep_index].stream_info = NULL;
                /* FIXME Unset maxPstreams in endpoint context and
                 * update deq ptr to point to normal string ring.
                 */
@@ -1830,6 +1828,7 @@ int xhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev,
        for (i = 0; i < num_eps; i++) {
                ep_index = xhci_get_endpoint_index(&eps[i]->desc);
                xhci_free_stream_info(xhci, vdev->eps[ep_index].stream_info);
+               vdev->eps[ep_index].stream_info = NULL;
                /* FIXME Unset maxPstreams in endpoint context and
                 * update deq ptr to point to normal string ring.
                 */