aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-01-19 10:46:27 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-20 17:49:58 -0500
commit6a8e87b23ff4a979bde5451a242466a4b3f9fe7d (patch)
tree3b3da90cdf42c363fbd6270c58dd21811b8e3004 /drivers
parent1393adb2ebb00a2cd54b293cd7ee71e3376f4e9f (diff)
[PATCH] USB core and HCDs: don't put_device while atomic
This patch (as640) removes several put_device and the corresponding get_device calls from the USB core and HCDs. Some of the puts were done in atomic contexts, and none of them are needed since the core now guarantees that every endpoint will be disabled and every URB completed before a USB device is released. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/hcd.c2
-rw-r--r--drivers/usb/host/ehci-mem.c1
-rw-r--r--drivers/usb/host/ehci-q.c2
-rw-r--r--drivers/usb/host/ehci-sched.c6
-rw-r--r--drivers/usb/host/isp116x-hcd.c3
-rw-r--r--drivers/usb/host/sl811-hcd.c3
-rw-r--r--drivers/usb/host/uhci-q.c2
7 files changed, 5 insertions, 14 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index a98d978d76e2..fbd938d4ea58 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1105,7 +1105,6 @@ static void urb_unlink (struct urb *urb)
1105 spin_lock_irqsave (&hcd_data_lock, flags); 1105 spin_lock_irqsave (&hcd_data_lock, flags);
1106 list_del_init (&urb->urb_list); 1106 list_del_init (&urb->urb_list);
1107 spin_unlock_irqrestore (&hcd_data_lock, flags); 1107 spin_unlock_irqrestore (&hcd_data_lock, flags);
1108 usb_put_dev (urb->dev);
1109} 1108}
1110 1109
1111 1110
@@ -1145,7 +1144,6 @@ static int hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
1145 case HC_STATE_RUNNING: 1144 case HC_STATE_RUNNING:
1146 case HC_STATE_RESUMING: 1145 case HC_STATE_RESUMING:
1147doit: 1146doit:
1148 usb_get_dev (urb->dev);
1149 list_add_tail (&urb->urb_list, &ep->urb_list); 1147 list_add_tail (&urb->urb_list, &ep->urb_list);
1150 status = 0; 1148 status = 0;
1151 break; 1149 break;
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 91c2ab43cbcc..ec7eb3f4f867 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -75,7 +75,6 @@ static void qh_destroy (struct kref *kref)
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 usb_put_dev (qh->dev);
79 dma_pool_free (ehci->qh_pool, qh, qh->qh_dma); 78 dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
80} 79}
81 80
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 5ada7cd5698b..e469221e7ec3 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -702,7 +702,7 @@ qh_make (
702 } 702 }
703 703
704 /* support for tt scheduling, and access to toggles */ 704 /* support for tt scheduling, and access to toggles */
705 qh->dev = usb_get_dev (urb->dev); 705 qh->dev = urb->dev;
706 706
707 /* using TT? */ 707 /* using TT? */
708 switch (urb->dev->speed) { 708 switch (urb->dev->speed) {
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 88419c6823a8..90d6900a37f4 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1399,7 +1399,7 @@ itd_complete (
1399 */ 1399 */
1400 1400
1401 /* give urb back to the driver ... can be out-of-order */ 1401 /* give urb back to the driver ... can be out-of-order */
1402 dev = usb_get_dev (urb->dev); 1402 dev = urb->dev;
1403 ehci_urb_done (ehci, urb, regs); 1403 ehci_urb_done (ehci, urb, regs);
1404 urb = NULL; 1404 urb = NULL;
1405 1405
@@ -1418,7 +1418,6 @@ itd_complete (
1418 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); 1418 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
1419 } 1419 }
1420 iso_stream_put (ehci, stream); 1420 iso_stream_put (ehci, stream);
1421 usb_put_dev (dev);
1422 1421
1423 return 1; 1422 return 1;
1424} 1423}
@@ -1765,7 +1764,7 @@ sitd_complete (
1765 */ 1764 */
1766 1765
1767 /* give urb back to the driver */ 1766 /* give urb back to the driver */
1768 dev = usb_get_dev (urb->dev); 1767 dev = urb->dev;
1769 ehci_urb_done (ehci, urb, regs); 1768 ehci_urb_done (ehci, urb, regs);
1770 urb = NULL; 1769 urb = NULL;
1771 1770
@@ -1784,7 +1783,6 @@ sitd_complete (
1784 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); 1783 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
1785 } 1784 }
1786 iso_stream_put (ehci, stream); 1785 iso_stream_put (ehci, stream);
1787 usb_put_dev (dev);
1788 1786
1789 return 1; 1787 return 1;
1790} 1788}
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 972ce04889f8..fea5dcbec7c4 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -724,7 +724,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd,
724 ep = hep->hcpriv; 724 ep = hep->hcpriv;
725 else { 725 else {
726 INIT_LIST_HEAD(&ep->schedule); 726 INIT_LIST_HEAD(&ep->schedule);
727 ep->udev = usb_get_dev(udev); 727 ep->udev = udev;
728 ep->epnum = epnum; 728 ep->epnum = epnum;
729 ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out); 729 ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
730 usb_settoggle(udev, epnum, is_out, 0); 730 usb_settoggle(udev, epnum, is_out, 0);
@@ -891,7 +891,6 @@ static void isp116x_endpoint_disable(struct usb_hcd *hcd,
891 if (!list_empty(&hep->urb_list)) 891 if (!list_empty(&hep->urb_list))
892 WARN("ep %p not empty?\n", ep); 892 WARN("ep %p not empty?\n", ep);
893 893
894 usb_put_dev(ep->udev);
895 kfree(ep); 894 kfree(ep);
896 hep->hcpriv = NULL; 895 hep->hcpriv = NULL;
897} 896}
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 517360b77d8e..a92343052751 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -853,7 +853,7 @@ static int sl811h_urb_enqueue(
853 853
854 } else { 854 } else {
855 INIT_LIST_HEAD(&ep->schedule); 855 INIT_LIST_HEAD(&ep->schedule);
856 ep->udev = usb_get_dev(udev); 856 ep->udev = udev;
857 ep->epnum = epnum; 857 ep->epnum = epnum;
858 ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out); 858 ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
859 ep->defctrl = SL11H_HCTLMASK_ARM | SL11H_HCTLMASK_ENABLE; 859 ep->defctrl = SL11H_HCTLMASK_ARM | SL11H_HCTLMASK_ENABLE;
@@ -1052,7 +1052,6 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
1052 if (!list_empty(&hep->urb_list)) 1052 if (!list_empty(&hep->urb_list))
1053 WARN("ep %p not empty?\n", ep); 1053 WARN("ep %p not empty?\n", ep);
1054 1054
1055 usb_put_dev(ep->udev);
1056 kfree(ep); 1055 kfree(ep);
1057 hep->hcpriv = NULL; 1056 hep->hcpriv = NULL;
1058} 1057}
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 5d2f9575ab4f..a06d84c19e13 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -179,7 +179,6 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci,
179 qh->hep = hep; 179 qh->hep = hep;
180 qh->udev = udev; 180 qh->udev = udev;
181 hep->hcpriv = qh; 181 hep->hcpriv = qh;
182 usb_get_dev(udev);
183 182
184 } else { /* Skeleton QH */ 183 } else { /* Skeleton QH */
185 qh->state = QH_STATE_ACTIVE; 184 qh->state = QH_STATE_ACTIVE;
@@ -197,7 +196,6 @@ static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
197 list_del(&qh->node); 196 list_del(&qh->node);
198 if (qh->udev) { 197 if (qh->udev) {
199 qh->hep->hcpriv = NULL; 198 qh->hep->hcpriv = NULL;
200 usb_put_dev(qh->udev);
201 uhci_free_td(uhci, qh->dummy_td); 199 uhci_free_td(uhci, qh->dummy_td);
202 } 200 }
203 dma_pool_free(uhci->qh_pool, qh, qh->dma_handle); 201 dma_pool_free(uhci->qh_pool, qh, qh->dma_handle);