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

PCI PM: Put PM callbacks in the order of execution

Put PM callbacks in drivers/pci/pci-driver.c in the order in which
they are executed which makes it much easier to follow the code.

No functional changes should result from this.
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 d67e37d7
...@@ -384,6 +384,19 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) ...@@ -384,6 +384,19 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
return i; return i;
} }
static int pci_legacy_resume_early(struct device *dev)
{
int error = 0;
struct pci_dev * pci_dev = to_pci_dev(dev);
struct pci_driver * drv = pci_dev->driver;
pci_fixup_device(pci_fixup_resume_early, pci_dev);
if (drv && drv->resume_early)
error = drv->resume_early(pci_dev);
return error;
}
static int pci_legacy_resume(struct device *dev) static int pci_legacy_resume(struct device *dev)
{ {
int error; int error;
...@@ -402,19 +415,6 @@ static int pci_legacy_resume(struct device *dev) ...@@ -402,19 +415,6 @@ static int pci_legacy_resume(struct device *dev)
return error; return error;
} }
static int pci_legacy_resume_early(struct device *dev)
{
int error = 0;
struct pci_dev * pci_dev = to_pci_dev(dev);
struct pci_driver * drv = pci_dev->driver;
pci_fixup_device(pci_fixup_resume_early, pci_dev);
if (drv && drv->resume_early)
error = drv->resume_early(pci_dev);
return error;
}
/* Auxiliary functions used by the new power management framework */ /* Auxiliary functions used by the new power management framework */
static int pci_restore_standard_config(struct pci_dev *pci_dev) static int pci_restore_standard_config(struct pci_dev *pci_dev)
...@@ -569,36 +569,36 @@ static int pci_pm_suspend_noirq(struct device *dev) ...@@ -569,36 +569,36 @@ static int pci_pm_suspend_noirq(struct device *dev)
return error; return error;
} }
static int pci_pm_resume(struct device *dev) static int pci_pm_resume_noirq(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
if (pci_has_legacy_pm_support(pci_dev)) if (pci_has_legacy_pm_support(pci_dev))
return pci_legacy_resume(dev); return pci_legacy_resume_early(dev);
error = pci_pm_default_resume(pci_dev); pci_pm_default_resume_noirq(pci_dev);
if (!error && drv && drv->pm && drv->pm->resume) if (drv && drv->pm && drv->pm->resume_noirq)
error = drv->pm->resume(dev); error = drv->pm->resume_noirq(dev);
return error; return error;
} }
static int pci_pm_resume_noirq(struct device *dev) static int pci_pm_resume(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
if (pci_has_legacy_pm_support(pci_dev)) if (pci_has_legacy_pm_support(pci_dev))
return pci_legacy_resume_early(dev); return pci_legacy_resume(dev);
pci_pm_default_resume_noirq(pci_dev); error = pci_pm_default_resume(pci_dev);
if (drv && drv->pm && drv->pm->resume_noirq) if (!error && drv && drv->pm && drv->pm->resume)
error = drv->pm->resume_noirq(dev); error = drv->pm->resume(dev);
return error; return error;
} }
...@@ -654,36 +654,36 @@ static int pci_pm_freeze_noirq(struct device *dev) ...@@ -654,36 +654,36 @@ static int pci_pm_freeze_noirq(struct device *dev)
return error; return error;
} }
static int pci_pm_thaw(struct device *dev) static int pci_pm_thaw_noirq(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
if (pci_has_legacy_pm_support(pci_dev)) if (pci_has_legacy_pm_support(pci_dev))
return pci_legacy_resume(dev); return pci_legacy_resume_early(dev);
pci_pm_reenable_device(pci_dev); pci_update_current_state(pci_dev, PCI_D0);
if (drv && drv->pm && drv->pm->thaw) if (drv && drv->pm && drv->pm->thaw_noirq)
error = drv->pm->thaw(dev); error = drv->pm->thaw_noirq(dev);
return error; return error;
} }
static int pci_pm_thaw_noirq(struct device *dev) static int pci_pm_thaw(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
if (pci_has_legacy_pm_support(pci_dev)) if (pci_has_legacy_pm_support(pci_dev))
return pci_legacy_resume_early(dev); return pci_legacy_resume(dev);
pci_update_current_state(pci_dev, PCI_D0); pci_pm_reenable_device(pci_dev);
if (drv && drv->pm && drv->pm->thaw_noirq) if (drv && drv->pm && drv->pm->thaw)
error = drv->pm->thaw_noirq(dev); error = drv->pm->thaw(dev);
return error; return error;
} }
...@@ -724,36 +724,36 @@ static int pci_pm_poweroff_noirq(struct device *dev) ...@@ -724,36 +724,36 @@ static int pci_pm_poweroff_noirq(struct device *dev)
return error; return error;
} }
static int pci_pm_restore(struct device *dev) static int pci_pm_restore_noirq(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
if (pci_has_legacy_pm_support(pci_dev)) if (pci_has_legacy_pm_support(pci_dev))
return pci_legacy_resume(dev); return pci_legacy_resume_early(dev);
error = pci_pm_default_resume(pci_dev); pci_pm_default_resume_noirq(pci_dev);
if (!error && drv && drv->pm && drv->pm->restore) if (drv && drv->pm && drv->pm->restore_noirq)
error = drv->pm->restore(dev); error = drv->pm->restore_noirq(dev);
return error; return error;
} }
static int pci_pm_restore_noirq(struct device *dev) static int pci_pm_restore(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
struct device_driver *drv = dev->driver; struct device_driver *drv = dev->driver;
int error = 0; int error = 0;
if (pci_has_legacy_pm_support(pci_dev)) if (pci_has_legacy_pm_support(pci_dev))
return pci_legacy_resume_early(dev); return pci_legacy_resume(dev);
pci_pm_default_resume_noirq(pci_dev); error = pci_pm_default_resume(pci_dev);
if (drv && drv->pm && drv->pm->restore_noirq) if (!error && drv && drv->pm && drv->pm->restore)
error = drv->pm->restore_noirq(dev); error = drv->pm->restore(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