Commit c9b9972b authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Jesse Barnes

PCI PM: Fix poweroff and restore callbacks

pci_fixup_device() is called too early in pci_pm_poweroff() and too
late in pci_pm_restore().  Moreover, pci_pm_restore_noirq() calls
pci_fixup_device() twice and in a wrong way.  Fix that.
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Acked-by: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 987a4c78
...@@ -611,8 +611,6 @@ static int pci_pm_poweroff(struct device *dev) ...@@ -611,8 +611,6 @@ static int pci_pm_poweroff(struct device *dev)
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
pci_fixup_device(pci_fixup_suspend, pci_dev);
if (drv && drv->pm) { if (drv && drv->pm) {
if (drv->pm->poweroff) { if (drv->pm->poweroff) {
error = drv->pm->poweroff(dev); error = drv->pm->poweroff(dev);
...@@ -622,6 +620,8 @@ static int pci_pm_poweroff(struct device *dev) ...@@ -622,6 +620,8 @@ static int pci_pm_poweroff(struct device *dev)
error = pci_legacy_suspend(dev, PMSG_HIBERNATE); error = pci_legacy_suspend(dev, PMSG_HIBERNATE);
} }
pci_fixup_device(pci_fixup_suspend, pci_dev);
return error; return error;
} }
...@@ -648,6 +648,8 @@ static int pci_pm_restore(struct device *dev) ...@@ -648,6 +648,8 @@ static int pci_pm_restore(struct device *dev)
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
pci_fixup_device(pci_fixup_resume, pci_dev);
if (drv && drv->pm) { if (drv && drv->pm) {
if (drv->pm->restore) if (drv->pm->restore)
error = drv->pm->restore(dev); error = drv->pm->restore(dev);
...@@ -656,7 +658,6 @@ static int pci_pm_restore(struct device *dev) ...@@ -656,7 +658,6 @@ static int pci_pm_restore(struct device *dev)
} else { } else {
error = pci_default_pm_resume_late(pci_dev); error = pci_default_pm_resume_late(pci_dev);
} }
pci_fixup_device(pci_fixup_resume, pci_dev);
return error; return error;
} }
...@@ -667,7 +668,7 @@ static int pci_pm_restore_noirq(struct device *dev) ...@@ -667,7 +668,7 @@ static int pci_pm_restore_noirq(struct device *dev)
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
pci_fixup_device(pci_fixup_resume, pci_dev); pci_fixup_device(pci_fixup_resume_early, pci_dev);
if (drv && drv->pm) { if (drv && drv->pm) {
if (drv->pm->restore_noirq) if (drv->pm->restore_noirq)
...@@ -677,7 +678,6 @@ static int pci_pm_restore_noirq(struct device *dev) ...@@ -677,7 +678,6 @@ static int pci_pm_restore_noirq(struct device *dev)
} else { } else {
pci_default_pm_resume_early(pci_dev); pci_default_pm_resume_early(pci_dev);
} }
pci_fixup_device(pci_fixup_resume_early, pci_dev);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment