aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorAndiry Xu <andiry.xu@amd.com>2011-09-02 14:05:57 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-09 18:52:54 -0400
commit2ffdea25f054439c31c24b248faa647685280571 (patch)
treee15603e52db3cd197642fccc115bc58abb4185bb /drivers/usb/host/xhci-mem.c
parentfd984d242afbe13bd94c60b6754feda93be69bd7 (diff)
xHCI: refine td allocation
In xhci_urb_enqueue(), allocate a block of memory for all the TDs instead of allocating memory for each of them separately. This reduces the number of kzalloc calling when an isochronous usb is submitted. Signed-off-by: Andiry Xu <andiry.xu@amd.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 1c5c9ba141db..c4b8959e01e7 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1666,18 +1666,10 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci,
1666 1666
1667void xhci_urb_free_priv(struct xhci_hcd *xhci, struct urb_priv *urb_priv) 1667void xhci_urb_free_priv(struct xhci_hcd *xhci, struct urb_priv *urb_priv)
1668{ 1668{
1669 int last; 1669 if (urb_priv) {
1670 1670 kfree(urb_priv->td[0]);
1671 if (!urb_priv) 1671 kfree(urb_priv);
1672 return;
1673
1674 last = urb_priv->length - 1;
1675 if (last >= 0) {
1676 int i;
1677 for (i = 0; i <= last; i++)
1678 kfree(urb_priv->td[i]);
1679 } 1672 }
1680 kfree(urb_priv);
1681} 1673}
1682 1674
1683void xhci_free_command(struct xhci_hcd *xhci, 1675void xhci_free_command(struct xhci_hcd *xhci,