Commit 26825cfd authored by Ulf Hansson's avatar Ulf Hansson Committed by Russell King

ARM: 7914/1: amba: Drop legacy PM support and use the pm_generic functions

All AMBA drivers have converted to use the modern PM ops thus we can
safely drop the legacy PM support from the bus.

While using the modern PM ops it also makes sense to convert to use the
pm_generic callback functions.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent dc1ccc48
...@@ -83,162 +83,6 @@ static struct device_attribute amba_dev_attrs[] = { ...@@ -83,162 +83,6 @@ static struct device_attribute amba_dev_attrs[] = {
__ATTR_NULL, __ATTR_NULL,
}; };
#ifdef CONFIG_PM_SLEEP
static int amba_legacy_suspend(struct device *dev, pm_message_t mesg)
{
struct amba_driver *adrv = to_amba_driver(dev->driver);
struct amba_device *adev = to_amba_device(dev);
int ret = 0;
if (dev->driver && adrv->suspend)
ret = adrv->suspend(adev, mesg);
return ret;
}
static int amba_legacy_resume(struct device *dev)
{
struct amba_driver *adrv = to_amba_driver(dev->driver);
struct amba_device *adev = to_amba_device(dev);
int ret = 0;
if (dev->driver && adrv->resume)
ret = adrv->resume(adev);
return ret;
}
#endif /* CONFIG_PM_SLEEP */
#ifdef CONFIG_SUSPEND
static int amba_pm_suspend(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->suspend)
ret = drv->pm->suspend(dev);
} else {
ret = amba_legacy_suspend(dev, PMSG_SUSPEND);
}
return ret;
}
static int amba_pm_resume(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->resume)
ret = drv->pm->resume(dev);
} else {
ret = amba_legacy_resume(dev);
}
return ret;
}
#else /* !CONFIG_SUSPEND */
#define amba_pm_suspend NULL
#define amba_pm_resume NULL
#endif /* !CONFIG_SUSPEND */
#ifdef CONFIG_HIBERNATE_CALLBACKS
static int amba_pm_freeze(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->freeze)
ret = drv->pm->freeze(dev);
} else {
ret = amba_legacy_suspend(dev, PMSG_FREEZE);
}
return ret;
}
static int amba_pm_thaw(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->thaw)
ret = drv->pm->thaw(dev);
} else {
ret = amba_legacy_resume(dev);
}
return ret;
}
static int amba_pm_poweroff(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->poweroff)
ret = drv->pm->poweroff(dev);
} else {
ret = amba_legacy_suspend(dev, PMSG_HIBERNATE);
}
return ret;
}
static int amba_pm_restore(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->restore)
ret = drv->pm->restore(dev);
} else {
ret = amba_legacy_resume(dev);
}
return ret;
}
#else /* !CONFIG_HIBERNATE_CALLBACKS */
#define amba_pm_freeze NULL
#define amba_pm_thaw NULL
#define amba_pm_poweroff NULL
#define amba_pm_restore NULL
#endif /* !CONFIG_HIBERNATE_CALLBACKS */
#ifdef CONFIG_PM_RUNTIME #ifdef CONFIG_PM_RUNTIME
/* /*
* Hooks to provide runtime PM of the pclk (bus clock). It is safe to * Hooks to provide runtime PM of the pclk (bus clock). It is safe to
...@@ -272,15 +116,13 @@ static int amba_pm_runtime_resume(struct device *dev) ...@@ -272,15 +116,13 @@ static int amba_pm_runtime_resume(struct device *dev)
} }
#endif #endif
#ifdef CONFIG_PM
static const struct dev_pm_ops amba_pm = { static const struct dev_pm_ops amba_pm = {
.suspend = amba_pm_suspend, .suspend = pm_generic_suspend,
.resume = amba_pm_resume, .resume = pm_generic_resume,
.freeze = amba_pm_freeze, .freeze = pm_generic_freeze,
.thaw = amba_pm_thaw, .thaw = pm_generic_thaw,
.poweroff = amba_pm_poweroff, .poweroff = pm_generic_poweroff,
.restore = amba_pm_restore, .restore = pm_generic_restore,
SET_RUNTIME_PM_OPS( SET_RUNTIME_PM_OPS(
amba_pm_runtime_suspend, amba_pm_runtime_suspend,
amba_pm_runtime_resume, amba_pm_runtime_resume,
...@@ -288,14 +130,6 @@ static const struct dev_pm_ops amba_pm = { ...@@ -288,14 +130,6 @@ static const struct dev_pm_ops amba_pm = {
) )
}; };
#define AMBA_PM (&amba_pm)
#else /* !CONFIG_PM */
#define AMBA_PM NULL
#endif /* !CONFIG_PM */
/* /*
* Primecells are part of the Advanced Microcontroller Bus Architecture, * Primecells are part of the Advanced Microcontroller Bus Architecture,
* so we call the bus "amba". * so we call the bus "amba".
...@@ -305,7 +139,7 @@ struct bus_type amba_bustype = { ...@@ -305,7 +139,7 @@ struct bus_type amba_bustype = {
.dev_attrs = amba_dev_attrs, .dev_attrs = amba_dev_attrs,
.match = amba_match, .match = amba_match,
.uevent = amba_uevent, .uevent = amba_uevent,
.pm = AMBA_PM, .pm = &amba_pm,
}; };
static int __init amba_init(void) static int __init amba_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment