xHCI: store ring's last segment and segment numbers
authorAndiry Xu <andiry.xu@amd.com>
Mon, 5 Mar 2012 09:49:33 +0000 (17:49 +0800)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Tue, 13 Mar 2012 16:29:46 +0000 (09:29 -0700)
Store the ring's last segment pointer and number of segments for ring
expansion usage.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Paul Zimmerman <Paul.Zimmerman@synopsys.com>
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci.h

index 1699df9f256831e994164158eea94c32b4532463..bdea4de867b49adef701fdb5896477454507ac73 100644 (file)
@@ -154,6 +154,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci,
        if (!ring)
                return NULL;
 
+       ring->num_segs = num_segs;
        INIT_LIST_HEAD(&ring->td_list);
        ring->type = type;
        if (num_segs == 0)
@@ -177,6 +178,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci,
                num_segs--;
        }
        xhci_link_segments(xhci, prev, ring->first_seg, type);
+       ring->last_seg = prev;
 
        /* Only event ring does not use link TRB */
        if (type != TYPE_EVENT) {
index eb369a1723b1111bd2db0c4f9d727765ddd39e52..2337a8e80b60c07ee1cda8eae06deffcf584310d 100644 (file)
@@ -1262,6 +1262,7 @@ enum xhci_ring_type {
 
 struct xhci_ring {
        struct xhci_segment     *first_seg;
+       struct xhci_segment     *last_seg;
        union  xhci_trb         *enqueue;
        struct xhci_segment     *enq_seg;
        unsigned int            enq_updates;
@@ -1276,6 +1277,7 @@ struct xhci_ring {
         */
        u32                     cycle_state;
        unsigned int            stream_id;
+       unsigned int            num_segs;
        enum xhci_ring_type     type;
        bool                    last_td_was_short;
 };