aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-10-06 16:46:05 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 13:44:29 -0500
commitadf094931ffb25ef4b381559918f1a34181a5273 (patch)
treebd343d4c15b21dff6a73359fd2d82ff77e30e0d4 /drivers/base/power
parent238c6d54830c624f34ac9cf123ac04aebfca5013 (diff)
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>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/main.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 692c20ba5144..a8e4dcbcaf7a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -112,7 +112,8 @@ void device_pm_remove(struct device *dev)
112 * @ops: PM operations to choose from. 112 * @ops: PM operations to choose from.
113 * @state: PM transition of the system being carried out. 113 * @state: PM transition of the system being carried out.
114 */ 114 */
115static int pm_op(struct device *dev, struct pm_ops *ops, pm_message_t state) 115static int pm_op(struct device *dev, struct dev_pm_ops *ops,
116 pm_message_t state)
116{ 117{
117 int error = 0; 118 int error = 0;
118 119
@@ -174,7 +175,7 @@ static int pm_op(struct device *dev, struct pm_ops *ops, pm_message_t state)
174 * The operation is executed with interrupts disabled by the only remaining 175 * The operation is executed with interrupts disabled by the only remaining
175 * functional CPU in the system. 176 * functional CPU in the system.
176 */ 177 */
177static int pm_noirq_op(struct device *dev, struct pm_ext_ops *ops, 178static int pm_noirq_op(struct device *dev, struct dev_pm_ops *ops,
178 pm_message_t state) 179 pm_message_t state)
179{ 180{
180 int error = 0; 181 int error = 0;
@@ -354,7 +355,7 @@ static int resume_device(struct device *dev, pm_message_t state)
354 if (dev->bus) { 355 if (dev->bus) {
355 if (dev->bus->pm) { 356 if (dev->bus->pm) {
356 pm_dev_dbg(dev, state, ""); 357 pm_dev_dbg(dev, state, "");
357 error = pm_op(dev, &dev->bus->pm->base, state); 358 error = pm_op(dev, dev->bus->pm, state);
358 } else if (dev->bus->resume) { 359 } else if (dev->bus->resume) {
359 pm_dev_dbg(dev, state, "legacy "); 360 pm_dev_dbg(dev, state, "legacy ");
360 error = dev->bus->resume(dev); 361 error = dev->bus->resume(dev);
@@ -451,9 +452,9 @@ static void complete_device(struct device *dev, pm_message_t state)
451 dev->type->pm->complete(dev); 452 dev->type->pm->complete(dev);
452 } 453 }
453 454
454 if (dev->bus && dev->bus->pm && dev->bus->pm->base.complete) { 455 if (dev->bus && dev->bus->pm && dev->bus->pm->complete) {
455 pm_dev_dbg(dev, state, "completing "); 456 pm_dev_dbg(dev, state, "completing ");
456 dev->bus->pm->base.complete(dev); 457 dev->bus->pm->complete(dev);
457 } 458 }
458 459
459 up(&dev->sem); 460 up(&dev->sem);
@@ -624,7 +625,7 @@ static int suspend_device(struct device *dev, pm_message_t state)
624 if (dev->bus) { 625 if (dev->bus) {
625 if (dev->bus->pm) { 626 if (dev->bus->pm) {
626 pm_dev_dbg(dev, state, ""); 627 pm_dev_dbg(dev, state, "");
627 error = pm_op(dev, &dev->bus->pm->base, state); 628 error = pm_op(dev, dev->bus->pm, state);
628 } else if (dev->bus->suspend) { 629 } else if (dev->bus->suspend) {
629 pm_dev_dbg(dev, state, "legacy "); 630 pm_dev_dbg(dev, state, "legacy ");
630 error = dev->bus->suspend(dev, state); 631 error = dev->bus->suspend(dev, state);
@@ -685,10 +686,10 @@ static int prepare_device(struct device *dev, pm_message_t state)
685 686
686 down(&dev->sem); 687 down(&dev->sem);
687 688
688 if (dev->bus && dev->bus->pm && dev->bus->pm->base.prepare) { 689 if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) {
689 pm_dev_dbg(dev, state, "preparing "); 690 pm_dev_dbg(dev, state, "preparing ");
690 error = dev->bus->pm->base.prepare(dev); 691 error = dev->bus->pm->prepare(dev);
691 suspend_report_result(dev->bus->pm->base.prepare, error); 692 suspend_report_result(dev->bus->pm->prepare, error);
692 if (error) 693 if (error)
693 goto End; 694 goto End;
694 } 695 }