aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-q.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-q.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-q.c')
-rw-r--r--drivers/usb/host/ehci-q.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 4378bf72bbac..7d117bbffac1 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -265,7 +265,6 @@ __acquires(ehci->lock)
265 /* ... update hc-wide periodic stats (for usbfs) */ 265 /* ... update hc-wide periodic stats (for usbfs) */
266 ehci_to_hcd(ehci)->self.bandwidth_int_reqs--; 266 ehci_to_hcd(ehci)->self.bandwidth_int_reqs--;
267 } 267 }
268 qh_put (qh);
269 } 268 }
270 269
271 if (unlikely(urb->unlinked)) { 270 if (unlikely(urb->unlinked)) {
@@ -946,7 +945,7 @@ qh_make (
946 ehci_dbg(ehci, "bogus dev %p speed %d\n", urb->dev, 945 ehci_dbg(ehci, "bogus dev %p speed %d\n", urb->dev,
947 urb->dev->speed); 946 urb->dev->speed);
948done: 947done:
949 qh_put (qh); 948 qh_destroy(ehci, qh);
950 return NULL; 949 return NULL;
951 } 950 }
952 951
@@ -1003,7 +1002,6 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
1003 head->qh_next.qh = qh; 1002 head->qh_next.qh = qh;
1004 head->hw->hw_next = dma; 1003 head->hw->hw_next = dma;
1005 1004
1006 qh_get(qh);
1007 qh->xacterrs = 0; 1005 qh->xacterrs = 0;
1008 qh->qh_state = QH_STATE_LINKED; 1006 qh->qh_state = QH_STATE_LINKED;
1009 /* qtd completions reported later by interrupt */ 1007 /* qtd completions reported later by interrupt */
@@ -1090,7 +1088,7 @@ static struct ehci_qh *qh_append_tds (
1090 wmb (); 1088 wmb ();
1091 dummy->hw_token = token; 1089 dummy->hw_token = token;
1092 1090
1093 urb->hcpriv = qh_get (qh); 1091 urb->hcpriv = qh;
1094 } 1092 }
1095 } 1093 }
1096 return qh; 1094 return qh;
@@ -1167,7 +1165,6 @@ static void end_unlink_async (struct ehci_hcd *ehci)
1167 // qh->hw_next = cpu_to_hc32(qh->qh_dma); 1165 // qh->hw_next = cpu_to_hc32(qh->qh_dma);
1168 qh->qh_state = QH_STATE_IDLE; 1166 qh->qh_state = QH_STATE_IDLE;
1169 qh->qh_next.qh = NULL; 1167 qh->qh_next.qh = NULL;
1170 qh_put (qh); // refcount from reclaim
1171 1168
1172 /* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */ 1169 /* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
1173 next = qh->reclaim; 1170 next = qh->reclaim;
@@ -1186,7 +1183,6 @@ static void end_unlink_async (struct ehci_hcd *ehci)
1186 && ehci->async->qh_next.qh == NULL) 1183 && ehci->async->qh_next.qh == NULL)
1187 timer_action (ehci, TIMER_ASYNC_OFF); 1184 timer_action (ehci, TIMER_ASYNC_OFF);
1188 } 1185 }
1189 qh_put(qh); /* refcount from async list */
1190 1186
1191 if (next) { 1187 if (next) {
1192 ehci->reclaim = NULL; 1188 ehci->reclaim = NULL;
@@ -1230,7 +1226,7 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
1230 } 1226 }
1231 1227
1232 qh->qh_state = QH_STATE_UNLINK; 1228 qh->qh_state = QH_STATE_UNLINK;
1233 ehci->reclaim = qh = qh_get (qh); 1229 ehci->reclaim = qh;
1234 1230
1235 prev = ehci->async; 1231 prev = ehci->async;
1236 while (prev->qh_next.qh != qh) 1232 while (prev->qh_next.qh != qh)
@@ -1283,12 +1279,10 @@ static void scan_async (struct ehci_hcd *ehci)
1283 * gets unlinked then ehci->qh_scan_next is adjusted 1279 * gets unlinked then ehci->qh_scan_next is adjusted
1284 * in start_unlink_async(). 1280 * in start_unlink_async().
1285 */ 1281 */
1286 qh = qh_get(qh);
1287 temp = qh_completions(ehci, qh); 1282 temp = qh_completions(ehci, qh);
1288 if (qh->needs_rescan) 1283 if (qh->needs_rescan)
1289 unlink_async(ehci, qh); 1284 unlink_async(ehci, qh);
1290 qh->unlink_time = jiffies + EHCI_SHRINK_JIFFIES; 1285 qh->unlink_time = jiffies + EHCI_SHRINK_JIFFIES;
1291 qh_put(qh);
1292 if (temp != 0) 1286 if (temp != 0)
1293 goto rescan; 1287 goto rescan;
1294 } 1288 }