[PATCH 2/2] powerpc: Add power management support to VIO bus
Brian King
brking at linux.vnet.ibm.com
Wed Feb 24 11:02:36 EST 2010
Adds support for suspend/resume for VIO devices. This is needed for
support for HMC initiated hibernation.
Signed-off-by: Brian King <brking at linux.vnet.ibm.com>
---
arch/powerpc/kernel/vio.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff -puN arch/powerpc/kernel/vio.c~powerpc_vio_bus_pm arch/powerpc/kernel/vio.c
--- linux-2.6/arch/powerpc/kernel/vio.c~powerpc_vio_bus_pm 2010-02-21 09:56:18.000000000 -0600
+++ linux-2.6-bjking1/arch/powerpc/kernel/vio.c 2010-02-21 09:57:53.000000000 -0600
@@ -1357,6 +1357,29 @@ static int vio_hotplug(struct device *de
return 0;
}
+static int vio_pm_suspend(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm && pm->suspend)
+ return pm->suspend(dev);
+ return 0;
+}
+
+static int vio_pm_resume(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm && pm->resume)
+ return pm->resume(dev);
+ return 0;
+}
+
+const struct dev_pm_ops vio_dev_pm_ops = {
+ .suspend = vio_pm_suspend,
+ .resume = vio_pm_resume,
+};
+
static struct bus_type vio_bus_type = {
.name = "vio",
.dev_attrs = vio_dev_attrs,
@@ -1364,6 +1387,7 @@ static struct bus_type vio_bus_type = {
.match = vio_bus_match,
.probe = vio_bus_probe,
.remove = vio_bus_remove,
+ .pm = &vio_dev_pm_ops,
};
/**
_
More information about the Linuxppc-dev
mailing list