/** * frees the "ring" pointer passed * * @param ptr pointer to "ring" to be freed * @return none */ static void xhci_ring_free(struct xhci_ring *ring) { struct xhci_segment *seg; struct xhci_segment *first_seg; BUG_ON(!ring); first_seg = ring->first_seg; seg = first_seg->next; while (seg != first_seg) { struct xhci_segment *next = seg->next; xhci_segment_free(seg); seg = next; } xhci_segment_free(first_seg); free(ring); }
/* XXX: Do we need the hcd structure in all these functions? */ void xhci_ring_free(struct xhci_hcd *xhci, struct xhci_ring *ring) { struct xhci_segment *seg; struct xhci_segment *first_seg; if (!ring || !ring->first_seg) return; first_seg = ring->first_seg; seg = first_seg->next; xhci_dbg(xhci, "Freeing ring at %p\n", ring); while (seg != first_seg) { struct xhci_segment *next = seg->next; xhci_segment_free(xhci, seg); seg = next; } xhci_segment_free(xhci, first_seg); ring->first_seg = NULL; kfree(ring); }