aboutsummaryrefslogtreecommitdiffstats
path: root/usb/usb-move-pci-hcd-resume-routine.patch
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2010-07-07 15:03:48 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2010-07-07 15:03:48 -0700
commitb206e0eb3226d813092580fd7a1f8c3e22589210 (patch)
treec6cff260238812077ef9d22896e41f7c1cb06839 /usb/usb-move-pci-hcd-resume-routine.patch
parent23c856a16cc0ae3d6f30c4e8b2b16b0d0649c243 (diff)
downloadpatches-b206e0eb3226d813092580fd7a1f8c3e22589210.tar.gz
usb patches
Diffstat (limited to 'usb/usb-move-pci-hcd-resume-routine.patch')
-rw-r--r--usb/usb-move-pci-hcd-resume-routine.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/usb/usb-move-pci-hcd-resume-routine.patch b/usb/usb-move-pci-hcd-resume-routine.patch
new file mode 100644
index 00000000000000..144b105d219642
--- /dev/null
+++ b/usb/usb-move-pci-hcd-resume-routine.patch
@@ -0,0 +1,120 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:55:11 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 14:02:03 -0400 (EDT)
+Subject: USB: move PCI HCD resume routine
+To: Greg KH <greg@kroah.com>
+Message-ID: <Pine.LNX.4.44L0.1006251239250.1604-100000@iolanthe.rowland.org>
+
+
+This patch (as1384) moves the resume_common() routine in hcd-pci.c a
+little higher in the source file to avoid forward references in an
+upcoming patch. It also replaces the "hibernated" argument with a
+more general "event" argument, which will be useful when the routine
+is called during a runtime resume.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/hcd-pci.c | 77 ++++++++++++++++++++++-----------------------
+ 1 file changed, 39 insertions(+), 38 deletions(-)
+
+--- a/drivers/usb/core/hcd-pci.c
++++ b/drivers/usb/core/hcd-pci.c
+@@ -403,6 +403,43 @@ static int hcd_pci_suspend(struct device
+ return retval;
+ }
+
++static int resume_common(struct device *dev, int event)
++{
++ struct pci_dev *pci_dev = to_pci_dev(dev);
++ struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
++ int retval;
++
++ if (hcd->state != HC_STATE_SUSPENDED) {
++ dev_dbg(dev, "can't resume, not suspended!\n");
++ return 0;
++ }
++
++ retval = pci_enable_device(pci_dev);
++ if (retval < 0) {
++ dev_err(dev, "can't re-enable after resume, %d!\n", retval);
++ return retval;
++ }
++
++ pci_set_master(pci_dev);
++
++ clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
++
++ if (hcd->driver->pci_resume) {
++ /* This call should be made only during system resume,
++ * not during runtime resume.
++ */
++ wait_for_companions(pci_dev, hcd);
++
++ retval = hcd->driver->pci_resume(hcd,
++ event == PM_EVENT_RESTORE);
++ if (retval) {
++ dev_err(dev, "PCI post-resume error %d!\n", retval);
++ usb_hc_died(hcd);
++ }
++ }
++ return retval;
++}
++
+ static int hcd_pci_suspend_noirq(struct device *dev)
+ {
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+@@ -452,50 +489,14 @@ static int hcd_pci_resume_noirq(struct d
+ return 0;
+ }
+
+-static int resume_common(struct device *dev, bool hibernated)
+-{
+- struct pci_dev *pci_dev = to_pci_dev(dev);
+- struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
+- int retval;
+-
+- if (hcd->state != HC_STATE_SUSPENDED) {
+- dev_dbg(dev, "can't resume, not suspended!\n");
+- return 0;
+- }
+-
+- retval = pci_enable_device(pci_dev);
+- if (retval < 0) {
+- dev_err(dev, "can't re-enable after resume, %d!\n", retval);
+- return retval;
+- }
+-
+- pci_set_master(pci_dev);
+-
+- clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
+-
+- if (hcd->driver->pci_resume) {
+- /* This call should be made only during system resume,
+- * not during runtime resume.
+- */
+- wait_for_companions(pci_dev, hcd);
+-
+- retval = hcd->driver->pci_resume(hcd, hibernated);
+- if (retval) {
+- dev_err(dev, "PCI post-resume error %d!\n", retval);
+- usb_hc_died(hcd);
+- }
+- }
+- return retval;
+-}
+-
+ static int hcd_pci_resume(struct device *dev)
+ {
+- return resume_common(dev, false);
++ return resume_common(dev, PM_EVENT_RESUME);
+ }
+
+ static int hcd_pci_restore(struct device *dev)
+ {
+- return resume_common(dev, true);
++ return resume_common(dev, PM_EVENT_RESTORE);
+ }
+
+ const struct dev_pm_ops usb_hcd_pci_pm_ops = {