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

Commit 7be7d741 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman
Browse files

USB: clarify usage of hcd->suspend/resume methods



The .suspend and .resume method pointers in struct usb_hcd have not
been fully understood by host-controller driver writers.  They are
meant for use with PCI controllers; other platform-specific drivers
generally should not refer to them.

To try and clarify matters, this patch (as1065) renames those methods
to .pci_suspend and .pci_resume.  It eliminates corresponding dead code
and bogus references in the ohci-ssb and u132-hcd drivers.

Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7329e211
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -215,9 +215,9 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
			hcd->state == HC_STATE_HALT))
		return -EBUSY;

	if (hcd->driver->suspend) {
		retval = hcd->driver->suspend(hcd, message);
		suspend_report_result(hcd->driver->suspend, retval);
	if (hcd->driver->pci_suspend) {
		retval = hcd->driver->pci_suspend(hcd, message);
		suspend_report_result(hcd->driver->pci_suspend, retval);
		if (retval)
			goto done;
	}
@@ -405,8 +405,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev)

	clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);

	if (hcd->driver->resume) {
		retval = hcd->driver->resume(hcd);
	if (hcd->driver->pci_resume) {
		retval = hcd->driver->pci_resume(hcd);
		if (retval) {
			dev_err(hcd->self.controller,
				"PCI post-resume error %d!\n", retval);
+2 −2
Original line number Diff line number Diff line
@@ -178,10 +178,10 @@ struct hc_driver {
	 * a whole, not just the root hub; they're for PCI bus glue.
	 */
	/* called after suspending the hub, before entering D3 etc */
	int	(*suspend) (struct usb_hcd *hcd, pm_message_t message);
	int	(*pci_suspend) (struct usb_hcd *hcd, pm_message_t message);

	/* called after entering D0 (etc), before resuming the hub */
	int	(*resume) (struct usb_hcd *hcd);
	int	(*pci_resume) (struct usb_hcd *hcd);

	/* cleanly make HCD stop writing memory and doing I/O */
	void	(*stop) (struct usb_hcd *hcd);
+2 −2
Original line number Diff line number Diff line
@@ -353,8 +353,8 @@ static const struct hc_driver ehci_pci_hc_driver = {
	.reset =		ehci_pci_setup,
	.start =		ehci_run,
#ifdef	CONFIG_PM
	.suspend =		ehci_pci_suspend,
	.resume =		ehci_pci_resume,
	.pci_suspend =		ehci_pci_suspend,
	.pci_resume =		ehci_pci_resume,
#endif
	.stop =			ehci_stop,
	.shutdown =		ehci_shutdown,
+2 −3
Original line number Diff line number Diff line
@@ -347,9 +347,8 @@ static const struct hc_driver ohci_pci_hc_driver = {
	.shutdown =		ohci_shutdown,

#ifdef	CONFIG_PM
	/* these suspend/resume entries are for upstream PCI glue ONLY */
	.suspend =		ohci_pci_suspend,
	.resume =		ohci_pci_resume,
	.pci_suspend =		ohci_pci_suspend,
	.pci_resume =		ohci_pci_resume,
#endif

	/*
+0 −35
Original line number Diff line number Diff line
@@ -60,36 +60,6 @@ static int ssb_ohci_start(struct usb_hcd *hcd)
	return err;
}

#ifdef CONFIG_PM
static int ssb_ohci_hcd_suspend(struct usb_hcd *hcd, pm_message_t message)
{
	struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
	struct ohci_hcd *ohci = &ohcidev->ohci;
	unsigned long flags;

	spin_lock_irqsave(&ohci->lock, flags);

	ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
	ohci_readl(ohci, &ohci->regs->intrdisable); /* commit write */

	/* make sure snapshot being resumed re-enumerates everything */
	if (message.event == PM_EVENT_PRETHAW)
		ohci_usb_reset(ohci);

	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);

	spin_unlock_irqrestore(&ohci->lock, flags);
	return 0;
}

static int ssb_ohci_hcd_resume(struct usb_hcd *hcd)
{
	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
	usb_hcd_resume_root_hub(hcd);
	return 0;
}
#endif /* CONFIG_PM */

static const struct hc_driver ssb_ohci_hc_driver = {
	.description		= "ssb-usb-ohci",
	.product_desc		= "SSB OHCI Controller",
@@ -103,11 +73,6 @@ static const struct hc_driver ssb_ohci_hc_driver = {
	.stop			= ohci_stop,
	.shutdown		= ohci_shutdown,

#ifdef CONFIG_PM
	.suspend		= ssb_ohci_hcd_suspend,
	.resume			= ssb_ohci_hcd_resume,
#endif

	.urb_enqueue		= ohci_urb_enqueue,
	.urb_dequeue		= ohci_urb_dequeue,
	.endpoint_disable	= ohci_endpoint_disable,
Loading