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: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
Родитель
d67e37d793
Коммит
f6dc1e5e3d
|
@ -384,6 +384,19 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
|
|||
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)
|
||||
{
|
||||
int error;
|
||||
|
@ -402,19 +415,6 @@ static int pci_legacy_resume(struct device *dev)
|
|||
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 */
|
||||
|
||||
static int pci_restore_standard_config(struct pci_dev *pci_dev)
|
||||
|
@ -569,23 +569,6 @@ static int pci_pm_suspend_noirq(struct device *dev)
|
|||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_resume(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
struct device_driver *drv = dev->driver;
|
||||
int error = 0;
|
||||
|
||||
if (pci_has_legacy_pm_support(pci_dev))
|
||||
return pci_legacy_resume(dev);
|
||||
|
||||
error = pci_pm_default_resume(pci_dev);
|
||||
|
||||
if (!error && drv && drv->pm && drv->pm->resume)
|
||||
error = drv->pm->resume(dev);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_resume_noirq(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
|
@ -603,6 +586,23 @@ static int pci_pm_resume_noirq(struct device *dev)
|
|||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_resume(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
struct device_driver *drv = dev->driver;
|
||||
int error = 0;
|
||||
|
||||
if (pci_has_legacy_pm_support(pci_dev))
|
||||
return pci_legacy_resume(dev);
|
||||
|
||||
error = pci_pm_default_resume(pci_dev);
|
||||
|
||||
if (!error && drv && drv->pm && drv->pm->resume)
|
||||
error = drv->pm->resume(dev);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
#else /* !CONFIG_SUSPEND */
|
||||
|
||||
#define pci_pm_suspend NULL
|
||||
|
@ -654,23 +654,6 @@ static int pci_pm_freeze_noirq(struct device *dev)
|
|||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_thaw(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
struct device_driver *drv = dev->driver;
|
||||
int error = 0;
|
||||
|
||||
if (pci_has_legacy_pm_support(pci_dev))
|
||||
return pci_legacy_resume(dev);
|
||||
|
||||
pci_pm_reenable_device(pci_dev);
|
||||
|
||||
if (drv && drv->pm && drv->pm->thaw)
|
||||
error = drv->pm->thaw(dev);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_thaw_noirq(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
|
@ -688,6 +671,23 @@ static int pci_pm_thaw_noirq(struct device *dev)
|
|||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_thaw(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
struct device_driver *drv = dev->driver;
|
||||
int error = 0;
|
||||
|
||||
if (pci_has_legacy_pm_support(pci_dev))
|
||||
return pci_legacy_resume(dev);
|
||||
|
||||
pci_pm_reenable_device(pci_dev);
|
||||
|
||||
if (drv && drv->pm && drv->pm->thaw)
|
||||
error = drv->pm->thaw(dev);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_poweroff(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
|
@ -724,23 +724,6 @@ static int pci_pm_poweroff_noirq(struct device *dev)
|
|||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_restore(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
struct device_driver *drv = dev->driver;
|
||||
int error = 0;
|
||||
|
||||
if (pci_has_legacy_pm_support(pci_dev))
|
||||
return pci_legacy_resume(dev);
|
||||
|
||||
error = pci_pm_default_resume(pci_dev);
|
||||
|
||||
if (!error && drv && drv->pm && drv->pm->restore)
|
||||
error = drv->pm->restore(dev);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_restore_noirq(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
|
@ -758,6 +741,23 @@ static int pci_pm_restore_noirq(struct device *dev)
|
|||
return error;
|
||||
}
|
||||
|
||||
static int pci_pm_restore(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||
struct device_driver *drv = dev->driver;
|
||||
int error = 0;
|
||||
|
||||
if (pci_has_legacy_pm_support(pci_dev))
|
||||
return pci_legacy_resume(dev);
|
||||
|
||||
error = pci_pm_default_resume(pci_dev);
|
||||
|
||||
if (!error && drv && drv->pm && drv->pm->restore)
|
||||
error = drv->pm->restore(dev);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
#else /* !CONFIG_HIBERNATION */
|
||||
|
||||
#define pci_pm_freeze NULL
|
||||
|
|
Загрузка…
Ссылка в новой задаче