PCI PM: Call pci_fixup_device from legacy routines
The size of drivers/pci/pci-driver.c can be reduced quite a bit if pci_fixup_device() is called from the legacy PM callbacks, so make it happen. 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:
parent
bb80894543
commit
ad8cfa1def
|
@ -365,6 +365,9 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
|
||||||
*/
|
*/
|
||||||
pci_pm_set_unknown_state(pci_dev);
|
pci_pm_set_unknown_state(pci_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pci_fixup_device(pci_fixup_suspend, pci_dev);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,6 +390,8 @@ static int pci_legacy_resume(struct device *dev)
|
||||||
struct pci_dev * pci_dev = to_pci_dev(dev);
|
struct pci_dev * pci_dev = to_pci_dev(dev);
|
||||||
struct pci_driver * drv = pci_dev->driver;
|
struct pci_driver * drv = pci_dev->driver;
|
||||||
|
|
||||||
|
pci_fixup_device(pci_fixup_resume, pci_dev);
|
||||||
|
|
||||||
if (drv && drv->resume) {
|
if (drv && drv->resume) {
|
||||||
error = drv->resume(pci_dev);
|
error = drv->resume(pci_dev);
|
||||||
} else {
|
} else {
|
||||||
|
@ -403,6 +408,8 @@ static int pci_legacy_resume_early(struct device *dev)
|
||||||
struct pci_dev * pci_dev = to_pci_dev(dev);
|
struct pci_dev * pci_dev = to_pci_dev(dev);
|
||||||
struct pci_driver * drv = pci_dev->driver;
|
struct pci_driver * drv = pci_dev->driver;
|
||||||
|
|
||||||
|
pci_fixup_device(pci_fixup_resume_early, pci_dev);
|
||||||
|
|
||||||
if (drv && drv->resume_early)
|
if (drv && drv->resume_early)
|
||||||
error = drv->resume_early(pci_dev);
|
error = drv->resume_early(pci_dev);
|
||||||
return error;
|
return error;
|
||||||
|
@ -526,10 +533,8 @@ static int pci_pm_suspend(struct device *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))
|
||||||
error = pci_legacy_suspend(dev, PMSG_SUSPEND);
|
return pci_legacy_suspend(dev, PMSG_SUSPEND);
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
if (drv->pm->suspend) {
|
if (drv->pm->suspend) {
|
||||||
|
@ -540,7 +545,6 @@ static int pci_pm_suspend(struct device *dev)
|
||||||
pci_pm_default_suspend(pci_dev);
|
pci_pm_default_suspend(pci_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
|
||||||
pci_fixup_device(pci_fixup_suspend, pci_dev);
|
pci_fixup_device(pci_fixup_suspend, pci_dev);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@ -573,10 +577,8 @@ static int pci_pm_resume(struct device *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))
|
||||||
pci_fixup_device(pci_fixup_resume, pci_dev);
|
|
||||||
return pci_legacy_resume(dev);
|
return pci_legacy_resume(dev);
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
pci_fixup_device(pci_fixup_resume, pci_dev);
|
pci_fixup_device(pci_fixup_resume, pci_dev);
|
||||||
|
@ -596,10 +598,8 @@ static int pci_pm_resume_noirq(struct device *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))
|
||||||
pci_fixup_device(pci_fixup_resume_early, pci_dev);
|
|
||||||
return pci_legacy_resume_early(dev);
|
return pci_legacy_resume_early(dev);
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
pci_fixup_device(pci_fixup_resume_early, pci_dev);
|
pci_fixup_device(pci_fixup_resume_early, pci_dev);
|
||||||
|
@ -630,11 +630,8 @@ static int pci_pm_freeze(struct device *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))
|
||||||
error = pci_legacy_suspend(dev, PMSG_FREEZE);
|
return pci_legacy_suspend(dev, PMSG_FREEZE);
|
||||||
pci_fixup_device(pci_fixup_suspend, pci_dev);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
if (drv->pm->freeze) {
|
if (drv->pm->freeze) {
|
||||||
|
@ -675,10 +672,8 @@ static int pci_pm_thaw(struct device *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))
|
||||||
pci_fixup_device(pci_fixup_resume, pci_dev);
|
|
||||||
return pci_legacy_resume(dev);
|
return pci_legacy_resume(dev);
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
if (drv->pm->thaw)
|
if (drv->pm->thaw)
|
||||||
|
@ -696,10 +691,8 @@ static int pci_pm_thaw_noirq(struct device *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))
|
||||||
pci_fixup_device(pci_fixup_resume_early, to_pci_dev(dev));
|
|
||||||
return pci_legacy_resume_early(dev);
|
return pci_legacy_resume_early(dev);
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
if (drv->pm->thaw_noirq)
|
if (drv->pm->thaw_noirq)
|
||||||
|
@ -717,10 +710,8 @@ 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;
|
||||||
|
|
||||||
if (pci_has_legacy_pm_support(pci_dev)) {
|
if (pci_has_legacy_pm_support(pci_dev))
|
||||||
error = pci_legacy_suspend(dev, PMSG_HIBERNATE);
|
return pci_legacy_suspend(dev, PMSG_HIBERNATE);
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
if (drv->pm->poweroff) {
|
if (drv->pm->poweroff) {
|
||||||
|
@ -731,7 +722,6 @@ static int pci_pm_poweroff(struct device *dev)
|
||||||
pci_pm_default_suspend(pci_dev);
|
pci_pm_default_suspend(pci_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
|
||||||
pci_fixup_device(pci_fixup_suspend, pci_dev);
|
pci_fixup_device(pci_fixup_suspend, pci_dev);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@ -761,10 +751,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;
|
||||||
|
|
||||||
if (pci_has_legacy_pm_support(pci_dev)) {
|
if (pci_has_legacy_pm_support(pci_dev))
|
||||||
pci_fixup_device(pci_fixup_resume, pci_dev);
|
|
||||||
return pci_legacy_resume(dev);
|
return pci_legacy_resume(dev);
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
pci_fixup_device(pci_fixup_resume, pci_dev);
|
pci_fixup_device(pci_fixup_resume, pci_dev);
|
||||||
|
@ -784,10 +772,8 @@ 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;
|
||||||
|
|
||||||
if (pci_has_legacy_pm_support(pci_dev)) {
|
if (pci_has_legacy_pm_support(pci_dev))
|
||||||
pci_fixup_device(pci_fixup_resume_early, pci_dev);
|
|
||||||
return pci_legacy_resume_early(dev);
|
return pci_legacy_resume_early(dev);
|
||||||
}
|
|
||||||
|
|
||||||
if (drv && drv->pm) {
|
if (drv && drv->pm) {
|
||||||
pci_fixup_device(pci_fixup_resume_early, pci_dev);
|
pci_fixup_device(pci_fixup_resume_early, pci_dev);
|
||||||
|
|
Loading…
Reference in New Issue