[PATCH] USB core and HCDs: don't put_device while atomic
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 19 Jan 2006 15:46:27 +0000 (10:46 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Mar 2006 22:49:58 +0000 (14:49 -0800)
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>
drivers/usb/core/hcd.c
drivers/usb/host/ehci-mem.c
drivers/usb/host/ehci-q.c
drivers/usb/host/ehci-sched.c
drivers/usb/host/isp116x-hcd.c
drivers/usb/host/sl811-hcd.c
drivers/usb/host/uhci-q.c

index a98d978d76e2bbec2c2e7089ee6689bdca6feedb..fbd938d4ea589cc9d558d1f41cae0fad0dccd18b 100644 (file)
@@ -1105,7 +1105,6 @@ static void urb_unlink (struct urb *urb)
        spin_lock_irqsave (&hcd_data_lock, flags);
        list_del_init (&urb->urb_list);
        spin_unlock_irqrestore (&hcd_data_lock, flags);
-       usb_put_dev (urb->dev);
 }
 
 
@@ -1145,7 +1144,6 @@ static int hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
        case HC_STATE_RUNNING:
        case HC_STATE_RESUMING:
 doit:
-               usb_get_dev (urb->dev);
                list_add_tail (&urb->urb_list, &ep->urb_list);
                status = 0;
                break;
index 91c2ab43cbcc1a58412751505400e1db045f1909..ec7eb3f4f867b9a456fb6dc55c2d37cef79e715d 100644 (file)
@@ -75,7 +75,6 @@ static void qh_destroy (struct kref *kref)
        }
        if (qh->dummy)
                ehci_qtd_free (ehci, qh->dummy);
-       usb_put_dev (qh->dev);
        dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
 }
 
index 5ada7cd5698b5647f845cad19209391efbca6197..e469221e7ec392088fd1274e278175e29644f7a8 100644 (file)
@@ -702,7 +702,7 @@ qh_make (
        }
 
        /* support for tt scheduling, and access to toggles */
-       qh->dev = usb_get_dev (urb->dev);
+       qh->dev = urb->dev;
 
        /* using TT? */
        switch (urb->dev->speed) {
index 88419c6823a835a6f6980019bebaf30df6f536f8..90d6900a37f47c5ba4814c5c3b71d29689e95f19 100644 (file)
@@ -1399,7 +1399,7 @@ itd_complete (
         */
 
        /* give urb back to the driver ... can be out-of-order */
-       dev = usb_get_dev (urb->dev);
+       dev = urb->dev;
        ehci_urb_done (ehci, urb, regs);
        urb = NULL;
 
@@ -1418,7 +1418,6 @@ itd_complete (
                        (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
        }
        iso_stream_put (ehci, stream);
-       usb_put_dev (dev);
 
        return 1;
 }
@@ -1765,7 +1764,7 @@ sitd_complete (
         */
 
        /* give urb back to the driver */
-       dev = usb_get_dev (urb->dev);
+       dev = urb->dev;
        ehci_urb_done (ehci, urb, regs);
        urb = NULL;
 
@@ -1784,7 +1783,6 @@ sitd_complete (
                        (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
        }
        iso_stream_put (ehci, stream);
-       usb_put_dev (dev);
 
        return 1;
 }
index 972ce04889f8a9d602c060e896c4efa83b2ab1af..fea5dcbec7c4a2f8702fbe36d9cf7d8b198eb67a 100644 (file)
@@ -724,7 +724,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd,
                ep = hep->hcpriv;
        else {
                INIT_LIST_HEAD(&ep->schedule);
-               ep->udev = usb_get_dev(udev);
+               ep->udev = udev;
                ep->epnum = epnum;
                ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
                usb_settoggle(udev, epnum, is_out, 0);
@@ -891,7 +891,6 @@ static void isp116x_endpoint_disable(struct usb_hcd *hcd,
        if (!list_empty(&hep->urb_list))
                WARN("ep %p not empty?\n", ep);
 
-       usb_put_dev(ep->udev);
        kfree(ep);
        hep->hcpriv = NULL;
 }
index 517360b77d8e68521995655d7c53c5dc2a7e59ee..a92343052751c06b57cd99dbc50ed607e17b5eae 100644 (file)
@@ -853,7 +853,7 @@ static int sl811h_urb_enqueue(
 
        } else {
                INIT_LIST_HEAD(&ep->schedule);
-               ep->udev = usb_get_dev(udev);
+               ep->udev = udev;
                ep->epnum = epnum;
                ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
                ep->defctrl = SL11H_HCTLMASK_ARM | SL11H_HCTLMASK_ENABLE;
@@ -1052,7 +1052,6 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
        if (!list_empty(&hep->urb_list))
                WARN("ep %p not empty?\n", ep);
 
-       usb_put_dev(ep->udev);
        kfree(ep);
        hep->hcpriv = NULL;
 }
index 5d2f9575ab4fe799b046e5c0b6b25b6ab8c4bde7..a06d84c19e13c944f99ffa604cb15034c06ffd42 100644 (file)
@@ -179,7 +179,6 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci,
                qh->hep = hep;
                qh->udev = udev;
                hep->hcpriv = qh;
-               usb_get_dev(udev);
 
        } else {                /* Skeleton QH */
                qh->state = QH_STATE_ACTIVE;
@@ -197,7 +196,6 @@ static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
        list_del(&qh->node);
        if (qh->udev) {
                qh->hep->hcpriv = NULL;
-               usb_put_dev(qh->udev);
                uhci_free_td(uhci, qh->dummy_td);
        }
        dma_pool_free(uhci->qh_pool, qh, qh->dma_handle);