PM: Simplify the new suspend/hibernation framework for devices
PM: Simplify the new suspend/hibernation framework for devices Following the discussion at the Kernel Summit, simplify the new device PM framework by merging 'struct pm_ops' and 'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops' from 'struct platform_driver' and 'struct pci_driver'. After this change, the suspend/hibernation callbacks will only reside in 'struct device_driver' as well as at the bus type/ device class/device type level. Accordingly, PCI and platform device drivers are now expected to put their suspend/hibernation callbacks into the 'struct device_driver' embedded in 'struct pci_driver' or 'struct platform_driver', respectively. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@suse.cz> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
238c6d5483
commit
adf094931f
8 changed files with 119 additions and 151 deletions
|
@ -112,7 +112,8 @@ void device_pm_remove(struct device *dev)
|
|||
* @ops: PM operations to choose from.
|
||||
* @state: PM transition of the system being carried out.
|
||||
*/
|
||||
static int pm_op(struct device *dev, struct pm_ops *ops, pm_message_t state)
|
||||
static int pm_op(struct device *dev, struct dev_pm_ops *ops,
|
||||
pm_message_t state)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
|
@ -174,7 +175,7 @@ static int pm_op(struct device *dev, struct pm_ops *ops, pm_message_t state)
|
|||
* The operation is executed with interrupts disabled by the only remaining
|
||||
* functional CPU in the system.
|
||||
*/
|
||||
static int pm_noirq_op(struct device *dev, struct pm_ext_ops *ops,
|
||||
static int pm_noirq_op(struct device *dev, struct dev_pm_ops *ops,
|
||||
pm_message_t state)
|
||||
{
|
||||
int error = 0;
|
||||
|
@ -354,7 +355,7 @@ static int resume_device(struct device *dev, pm_message_t state)
|
|||
if (dev->bus) {
|
||||
if (dev->bus->pm) {
|
||||
pm_dev_dbg(dev, state, "");
|
||||
error = pm_op(dev, &dev->bus->pm->base, state);
|
||||
error = pm_op(dev, dev->bus->pm, state);
|
||||
} else if (dev->bus->resume) {
|
||||
pm_dev_dbg(dev, state, "legacy ");
|
||||
error = dev->bus->resume(dev);
|
||||
|
@ -451,9 +452,9 @@ static void complete_device(struct device *dev, pm_message_t state)
|
|||
dev->type->pm->complete(dev);
|
||||
}
|
||||
|
||||
if (dev->bus && dev->bus->pm && dev->bus->pm->base.complete) {
|
||||
if (dev->bus && dev->bus->pm && dev->bus->pm->complete) {
|
||||
pm_dev_dbg(dev, state, "completing ");
|
||||
dev->bus->pm->base.complete(dev);
|
||||
dev->bus->pm->complete(dev);
|
||||
}
|
||||
|
||||
up(&dev->sem);
|
||||
|
@ -624,7 +625,7 @@ static int suspend_device(struct device *dev, pm_message_t state)
|
|||
if (dev->bus) {
|
||||
if (dev->bus->pm) {
|
||||
pm_dev_dbg(dev, state, "");
|
||||
error = pm_op(dev, &dev->bus->pm->base, state);
|
||||
error = pm_op(dev, dev->bus->pm, state);
|
||||
} else if (dev->bus->suspend) {
|
||||
pm_dev_dbg(dev, state, "legacy ");
|
||||
error = dev->bus->suspend(dev, state);
|
||||
|
@ -685,10 +686,10 @@ static int prepare_device(struct device *dev, pm_message_t state)
|
|||
|
||||
down(&dev->sem);
|
||||
|
||||
if (dev->bus && dev->bus->pm && dev->bus->pm->base.prepare) {
|
||||
if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) {
|
||||
pm_dev_dbg(dev, state, "preparing ");
|
||||
error = dev->bus->pm->base.prepare(dev);
|
||||
suspend_report_result(dev->bus->pm->base.prepare, error);
|
||||
error = dev->bus->pm->prepare(dev);
|
||||
suspend_report_result(dev->bus->pm->prepare, error);
|
||||
if (error)
|
||||
goto End;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue