Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a8e87b2 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman
Browse files

[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: default avatarAlan Stern <stern@rowland.harvard.edu>
Acked-by: default avatarDavid Brownell <david-b@pacbell.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1393adb2
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -1105,7 +1105,6 @@ static void urb_unlink (struct urb *urb)
	spin_lock_irqsave (&hcd_data_lock, flags);
	spin_lock_irqsave (&hcd_data_lock, flags);
	list_del_init (&urb->urb_list);
	list_del_init (&urb->urb_list);
	spin_unlock_irqrestore (&hcd_data_lock, flags);
	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_RUNNING:
	case HC_STATE_RESUMING:
	case HC_STATE_RESUMING:
doit:
doit:
		usb_get_dev (urb->dev);
		list_add_tail (&urb->urb_list, &ep->urb_list);
		list_add_tail (&urb->urb_list, &ep->urb_list);
		status = 0;
		status = 0;
		break;
		break;
+0 −1
Original line number Original line Diff line number Diff line
@@ -75,7 +75,6 @@ static void qh_destroy (struct kref *kref)
	}
	}
	if (qh->dummy)
	if (qh->dummy)
		ehci_qtd_free (ehci, qh->dummy);
		ehci_qtd_free (ehci, qh->dummy);
	usb_put_dev (qh->dev);
	dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
	dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -702,7 +702,7 @@ qh_make (
	}
	}


	/* support for tt scheduling, and access to toggles */
	/* support for tt scheduling, and access to toggles */
	qh->dev = usb_get_dev (urb->dev);
	qh->dev = urb->dev;


	/* using TT? */
	/* using TT? */
	switch (urb->dev->speed) {
	switch (urb->dev->speed) {
+2 −4
Original line number Original line Diff line number Diff line
@@ -1399,7 +1399,7 @@ itd_complete (
	 */
	 */


	/* give urb back to the driver ... can be out-of-order */
	/* 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);
	ehci_urb_done (ehci, urb, regs);
	urb = NULL;
	urb = NULL;


@@ -1418,7 +1418,6 @@ itd_complete (
			(stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
			(stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
	}
	}
	iso_stream_put (ehci, stream);
	iso_stream_put (ehci, stream);
	usb_put_dev (dev);


	return 1;
	return 1;
}
}
@@ -1765,7 +1764,7 @@ sitd_complete (
	 */
	 */


	/* give urb back to the driver */
	/* give urb back to the driver */
	dev = usb_get_dev (urb->dev);
	dev = urb->dev;
	ehci_urb_done (ehci, urb, regs);
	ehci_urb_done (ehci, urb, regs);
	urb = NULL;
	urb = NULL;


@@ -1784,7 +1783,6 @@ sitd_complete (
			(stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
			(stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
	}
	}
	iso_stream_put (ehci, stream);
	iso_stream_put (ehci, stream);
	usb_put_dev (dev);


	return 1;
	return 1;
}
}
+1 −2
Original line number Original line Diff line number Diff line
@@ -724,7 +724,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd,
		ep = hep->hcpriv;
		ep = hep->hcpriv;
	else {
	else {
		INIT_LIST_HEAD(&ep->schedule);
		INIT_LIST_HEAD(&ep->schedule);
		ep->udev = usb_get_dev(udev);
		ep->udev = udev;
		ep->epnum = epnum;
		ep->epnum = epnum;
		ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
		ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
		usb_settoggle(udev, epnum, is_out, 0);
		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))
	if (!list_empty(&hep->urb_list))
		WARN("ep %p not empty?\n", ep);
		WARN("ep %p not empty?\n", ep);


	usb_put_dev(ep->udev);
	kfree(ep);
	kfree(ep);
	hep->hcpriv = NULL;
	hep->hcpriv = NULL;
}
}
Loading