Skip to content

Commit

Permalink
PM / Sleep: Remove forward-only callbacks from AMBA bus type
Browse files Browse the repository at this point in the history
The forward-only PM callbacks provided by the AMBA bus type are not
necessary any more, because the PM core executes driver callbacks
when the corresponding subsystem callbacks are not present, so drop
them.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
  • Loading branch information
Rafael J. Wysocki committed Dec 21, 2011
1 parent 9b39e73 commit 8114ab7
Showing 1 changed file with 1 addition and 135 deletions.
136 changes: 1 addition & 135 deletions drivers/amba/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,31 +109,7 @@ static int amba_legacy_resume(struct device *dev)
return ret;
}

static int amba_pm_prepare(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;

if (drv && drv->pm && drv->pm->prepare)
ret = drv->pm->prepare(dev);

return ret;
}

static void amba_pm_complete(struct device *dev)
{
struct device_driver *drv = dev->driver;

if (drv && drv->pm && drv->pm->complete)
drv->pm->complete(dev);
}

#else /* !CONFIG_PM_SLEEP */

#define amba_pm_prepare NULL
#define amba_pm_complete NULL

#endif /* !CONFIG_PM_SLEEP */
#endif /* CONFIG_PM_SLEEP */

#ifdef CONFIG_SUSPEND

Expand All @@ -155,22 +131,6 @@ static int amba_pm_suspend(struct device *dev)
return ret;
}

static int amba_pm_suspend_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;

if (!drv)
return 0;

if (drv->pm) {
if (drv->pm->suspend_noirq)
ret = drv->pm->suspend_noirq(dev);
}

return ret;
}

static int amba_pm_resume(struct device *dev)
{
struct device_driver *drv = dev->driver;
Expand All @@ -189,28 +149,10 @@ static int amba_pm_resume(struct device *dev)
return ret;
}

static int amba_pm_resume_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;

if (!drv)
return 0;

if (drv->pm) {
if (drv->pm->resume_noirq)
ret = drv->pm->resume_noirq(dev);
}

return ret;
}

#else /* !CONFIG_SUSPEND */

#define amba_pm_suspend NULL
#define amba_pm_resume NULL
#define amba_pm_suspend_noirq NULL
#define amba_pm_resume_noirq NULL

#endif /* !CONFIG_SUSPEND */

Expand All @@ -234,22 +176,6 @@ static int amba_pm_freeze(struct device *dev)
return ret;
}

static int amba_pm_freeze_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;

if (!drv)
return 0;

if (drv->pm) {
if (drv->pm->freeze_noirq)
ret = drv->pm->freeze_noirq(dev);
}

return ret;
}

static int amba_pm_thaw(struct device *dev)
{
struct device_driver *drv = dev->driver;
Expand All @@ -268,22 +194,6 @@ static int amba_pm_thaw(struct device *dev)
return ret;
}

static int amba_pm_thaw_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;

if (!drv)
return 0;

if (drv->pm) {
if (drv->pm->thaw_noirq)
ret = drv->pm->thaw_noirq(dev);
}

return ret;
}

static int amba_pm_poweroff(struct device *dev)
{
struct device_driver *drv = dev->driver;
Expand All @@ -302,22 +212,6 @@ static int amba_pm_poweroff(struct device *dev)
return ret;
}

static int amba_pm_poweroff_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;

if (!drv)
return 0;

if (drv->pm) {
if (drv->pm->poweroff_noirq)
ret = drv->pm->poweroff_noirq(dev);
}

return ret;
}

static int amba_pm_restore(struct device *dev)
{
struct device_driver *drv = dev->driver;
Expand All @@ -336,32 +230,12 @@ static int amba_pm_restore(struct device *dev)
return ret;
}

static int amba_pm_restore_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;

if (!drv)
return 0;

if (drv->pm) {
if (drv->pm->restore_noirq)
ret = drv->pm->restore_noirq(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
#define amba_pm_freeze_noirq NULL
#define amba_pm_thaw_noirq NULL
#define amba_pm_poweroff_noirq NULL
#define amba_pm_restore_noirq NULL

#endif /* !CONFIG_HIBERNATE_CALLBACKS */

Expand Down Expand Up @@ -402,20 +276,12 @@ static int amba_pm_runtime_resume(struct device *dev)
#ifdef CONFIG_PM

static const struct dev_pm_ops amba_pm = {
.prepare = amba_pm_prepare,
.complete = amba_pm_complete,
.suspend = amba_pm_suspend,
.resume = amba_pm_resume,
.freeze = amba_pm_freeze,
.thaw = amba_pm_thaw,
.poweroff = amba_pm_poweroff,
.restore = amba_pm_restore,
.suspend_noirq = amba_pm_suspend_noirq,
.resume_noirq = amba_pm_resume_noirq,
.freeze_noirq = amba_pm_freeze_noirq,
.thaw_noirq = amba_pm_thaw_noirq,
.poweroff_noirq = amba_pm_poweroff_noirq,
.restore_noirq = amba_pm_restore_noirq,
SET_RUNTIME_PM_OPS(
amba_pm_runtime_suspend,
amba_pm_runtime_resume,
Expand Down

0 comments on commit 8114ab7

Please sign in to comment.