aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-mem.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:25:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:25:16 -0400
commitbe90a49ca22a95f184d9f32d35b5247b44032849 (patch)
treed3c2edc18c003c384366f57901616ac29c80bc27 /drivers/usb/host/ehci-mem.c
parent1f0918d03ff4b5c94540c71ce889672abdbc2f4a (diff)
parenta87371b477774b290c27bc5cb7f4ccc5379574a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (142 commits) USB: Fix sysfs paths in documentation USB: skeleton: fix coding style issues. USB: O_NONBLOCK in read path of skeleton USB: make usb-skeleton honor O_NONBLOCK in write path USB: skel_read really sucks royally USB: Add hub descriptor update hook for xHCI USB: xhci: Support USB hubs. USB: xhci: Set multi-TT field for LS/FS devices under hubs. USB: xhci: Set route string for all devices. USB: xhci: Fix command wait list handling. USB: xhci: Change how xHCI commands are handled. USB: xhci: Refactor input device context setup. USB: xhci: Endpoint representation refactoring. USB: gadget: ether needs to select CRC32 USB: fix USBTMC get_capabilities success handling USB: fix missing error check in probing USB: usbfs: add USBDEVFS_URB_BULK_CONTINUATION flag USB: support for autosuspend in sierra while online USB: ehci-dbgp,ehci: Allow dbpg to work with suspend/resume USB: ehci-dbgp,documentation: Documentation updates for ehci-dbgp ...
Diffstat (limited to 'drivers/usb/host/ehci-mem.c')
-rw-r--r--drivers/usb/host/ehci-mem.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 10d52919abbb..aeda96e0af67 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -75,7 +75,8 @@ static void qh_destroy(struct ehci_qh *qh)
75 } 75 }
76 if (qh->dummy) 76 if (qh->dummy)
77 ehci_qtd_free (ehci, qh->dummy); 77 ehci_qtd_free (ehci, qh->dummy);
78 dma_pool_free (ehci->qh_pool, qh, qh->qh_dma); 78 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma);
79 kfree(qh);
79} 80}
80 81
81static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags) 82static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
@@ -83,12 +84,14 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
83 struct ehci_qh *qh; 84 struct ehci_qh *qh;
84 dma_addr_t dma; 85 dma_addr_t dma;
85 86
86 qh = (struct ehci_qh *) 87 qh = kzalloc(sizeof *qh, GFP_ATOMIC);
87 dma_pool_alloc (ehci->qh_pool, flags, &dma);
88 if (!qh) 88 if (!qh)
89 return qh; 89 goto done;
90 90 qh->hw = (struct ehci_qh_hw *)
91 memset (qh, 0, sizeof *qh); 91 dma_pool_alloc(ehci->qh_pool, flags, &dma);
92 if (!qh->hw)
93 goto fail;
94 memset(qh->hw, 0, sizeof *qh->hw);
92 qh->refcount = 1; 95 qh->refcount = 1;
93 qh->ehci = ehci; 96 qh->ehci = ehci;
94 qh->qh_dma = dma; 97 qh->qh_dma = dma;
@@ -99,10 +102,15 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
99 qh->dummy = ehci_qtd_alloc (ehci, flags); 102 qh->dummy = ehci_qtd_alloc (ehci, flags);
100 if (qh->dummy == NULL) { 103 if (qh->dummy == NULL) {
101 ehci_dbg (ehci, "no dummy td\n"); 104 ehci_dbg (ehci, "no dummy td\n");
102 dma_pool_free (ehci->qh_pool, qh, qh->qh_dma); 105 goto fail1;
103 qh = NULL;
104 } 106 }
107done:
105 return qh; 108 return qh;
109fail1:
110 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma);
111fail:
112 kfree(qh);
113 return NULL;
106} 114}
107 115
108/* to share a qh (cpu threads, or hc) */ 116/* to share a qh (cpu threads, or hc) */
@@ -180,7 +188,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
180 /* QHs for control/bulk/intr transfers */ 188 /* QHs for control/bulk/intr transfers */
181 ehci->qh_pool = dma_pool_create ("ehci_qh", 189 ehci->qh_pool = dma_pool_create ("ehci_qh",
182 ehci_to_hcd(ehci)->self.controller, 190 ehci_to_hcd(ehci)->self.controller,
183 sizeof (struct ehci_qh), 191 sizeof(struct ehci_qh_hw),
184 32 /* byte alignment (for hw parts) */, 192 32 /* byte alignment (for hw parts) */,
185 4096 /* can't cross 4K */); 193 4096 /* can't cross 4K */);
186 if (!ehci->qh_pool) { 194 if (!ehci->qh_pool) {