aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-mem.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-07-11 11:21:25 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-16 19:50:13 -0400
commitc83e1a9ff68a6535b81c40dc8fda99348ab480fb (patch)
treefea3bfe22caed0144933c8b065f2bf16937fd8fb /drivers/usb/host/ehci-mem.c
parent15be105b4a18c461b95fa683907f6da6deae1b75 (diff)
USB: EHCI: don't refcount QHs
This patch (as1567) removes ehci-hcd's reference counting of QH structures. It's not necessary to refcount these things because they always get deallocated at exactly one spot in ehci_endpoint_disable() (except for two special QHs, ehci->async and ehci->dummy) and are never used again. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ehci-mem.c')
-rw-r--r--drivers/usb/host/ehci-mem.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 12f70c302b0b..93132d8ad360 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -64,10 +64,8 @@ static inline void ehci_qtd_free (struct ehci_hcd *ehci, struct ehci_qtd *qtd)
64} 64}
65 65
66 66
67static void qh_destroy(struct ehci_qh *qh) 67static void qh_destroy(struct ehci_hcd *ehci, struct ehci_qh *qh)
68{ 68{
69 struct ehci_hcd *ehci = qh->ehci;
70
71 /* clean qtds first, and know this is not linked */ 69 /* clean qtds first, and know this is not linked */
72 if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) { 70 if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) {
73 ehci_dbg (ehci, "unused qh not empty!\n"); 71 ehci_dbg (ehci, "unused qh not empty!\n");
@@ -92,8 +90,6 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
92 if (!qh->hw) 90 if (!qh->hw)
93 goto fail; 91 goto fail;
94 memset(qh->hw, 0, sizeof *qh->hw); 92 memset(qh->hw, 0, sizeof *qh->hw);
95 qh->refcount = 1;
96 qh->ehci = ehci;
97 qh->qh_dma = dma; 93 qh->qh_dma = dma;
98 // INIT_LIST_HEAD (&qh->qh_list); 94 // INIT_LIST_HEAD (&qh->qh_list);
99 INIT_LIST_HEAD (&qh->qtd_list); 95 INIT_LIST_HEAD (&qh->qtd_list);
@@ -113,20 +109,6 @@ fail:
113 return NULL; 109 return NULL;
114} 110}
115 111
116/* to share a qh (cpu threads, or hc) */
117static inline struct ehci_qh *qh_get (struct ehci_qh *qh)
118{
119 WARN_ON(!qh->refcount);
120 qh->refcount++;
121 return qh;
122}
123
124static inline void qh_put (struct ehci_qh *qh)
125{
126 if (!--qh->refcount)
127 qh_destroy(qh);
128}
129
130/*-------------------------------------------------------------------------*/ 112/*-------------------------------------------------------------------------*/
131 113
132/* The queue heads and transfer descriptors are managed from pools tied 114/* The queue heads and transfer descriptors are managed from pools tied
@@ -138,11 +120,11 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
138{ 120{
139 free_cached_lists(ehci); 121 free_cached_lists(ehci);
140 if (ehci->async) 122 if (ehci->async)
141 qh_put (ehci->async); 123 qh_destroy(ehci, ehci->async);
142 ehci->async = NULL; 124 ehci->async = NULL;
143 125
144 if (ehci->dummy) 126 if (ehci->dummy)
145 qh_put(ehci->dummy); 127 qh_destroy(ehci, ehci->dummy);
146 ehci->dummy = NULL; 128 ehci->dummy = NULL;
147 129
148 /* DMA consistent memory and pools */ 130 /* DMA consistent memory and pools */