Skip to content

Commit

Permalink
powerpc/vio: Add power management support
Browse files Browse the repository at this point in the history
Adds support for suspend/resume for VIO devices. This is needed for
support for HMC initiated hibernation.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Benjamin Herrenschmidt committed Apr 7, 2010
1 parent 8260cf6 commit a32aaf1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions arch/powerpc/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,13 +1381,37 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
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,
.uevent = vio_hotplug,
.match = vio_bus_match,
.probe = vio_bus_probe,
.remove = vio_bus_remove,
.pm = &vio_dev_pm_ops,
};

/**
Expand Down

0 comments on commit a32aaf1

Please sign in to comment.