Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245363
b: refs/heads/master
c: 69c9dd1
h: refs/heads/master
i:
  245361: a4f9af1
  245359: 6a0c108
v: v3
  • Loading branch information
Rafael J. Wysocki committed Apr 28, 2011
1 parent 4c47892 commit 01187e0
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 55 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4d27e9dcff00a6425d779b065ec8892e4f391661
refs/heads/master: 69c9dd1ecf446ad8a830e4afc539a2a1adc85b78
72 changes: 18 additions & 54 deletions trunk/drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ static int platform_legacy_resume(struct device *dev)
return ret;
}

static int platform_pm_prepare(struct device *dev)
int platform_pm_prepare(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -678,24 +678,19 @@ static int platform_pm_prepare(struct device *dev)
return ret;
}

static void platform_pm_complete(struct device *dev)
void platform_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 platform_pm_prepare NULL
#define platform_pm_complete NULL

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

#ifdef CONFIG_SUSPEND

int __weak platform_pm_suspend(struct device *dev)
int platform_pm_suspend(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -713,7 +708,7 @@ int __weak platform_pm_suspend(struct device *dev)
return ret;
}

int __weak platform_pm_suspend_noirq(struct device *dev)
int platform_pm_suspend_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -729,7 +724,7 @@ int __weak platform_pm_suspend_noirq(struct device *dev)
return ret;
}

int __weak platform_pm_resume(struct device *dev)
int platform_pm_resume(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -747,7 +742,7 @@ int __weak platform_pm_resume(struct device *dev)
return ret;
}

int __weak platform_pm_resume_noirq(struct device *dev)
int platform_pm_resume_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -763,18 +758,11 @@ int __weak platform_pm_resume_noirq(struct device *dev)
return ret;
}

#else /* !CONFIG_SUSPEND */

#define platform_pm_suspend NULL
#define platform_pm_resume NULL
#define platform_pm_suspend_noirq NULL
#define platform_pm_resume_noirq NULL

#endif /* !CONFIG_SUSPEND */
#endif /* CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATE_CALLBACKS

static int platform_pm_freeze(struct device *dev)
int platform_pm_freeze(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -792,7 +780,7 @@ static int platform_pm_freeze(struct device *dev)
return ret;
}

static int platform_pm_freeze_noirq(struct device *dev)
int platform_pm_freeze_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -808,7 +796,7 @@ static int platform_pm_freeze_noirq(struct device *dev)
return ret;
}

static int platform_pm_thaw(struct device *dev)
int platform_pm_thaw(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -826,7 +814,7 @@ static int platform_pm_thaw(struct device *dev)
return ret;
}

static int platform_pm_thaw_noirq(struct device *dev)
int platform_pm_thaw_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -842,7 +830,7 @@ static int platform_pm_thaw_noirq(struct device *dev)
return ret;
}

static int platform_pm_poweroff(struct device *dev)
int platform_pm_poweroff(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -860,7 +848,7 @@ static int platform_pm_poweroff(struct device *dev)
return ret;
}

static int platform_pm_poweroff_noirq(struct device *dev)
int platform_pm_poweroff_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -876,7 +864,7 @@ static int platform_pm_poweroff_noirq(struct device *dev)
return ret;
}

static int platform_pm_restore(struct device *dev)
int platform_pm_restore(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -894,7 +882,7 @@ static int platform_pm_restore(struct device *dev)
return ret;
}

static int platform_pm_restore_noirq(struct device *dev)
int platform_pm_restore_noirq(struct device *dev)
{
struct device_driver *drv = dev->driver;
int ret = 0;
Expand All @@ -910,18 +898,7 @@ static int platform_pm_restore_noirq(struct device *dev)
return ret;
}

#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define platform_pm_freeze NULL
#define platform_pm_thaw NULL
#define platform_pm_poweroff NULL
#define platform_pm_restore NULL
#define platform_pm_freeze_noirq NULL
#define platform_pm_thaw_noirq NULL
#define platform_pm_poweroff_noirq NULL
#define platform_pm_restore_noirq NULL

#endif /* !CONFIG_HIBERNATE_CALLBACKS */
#endif /* CONFIG_HIBERNATE_CALLBACKS */

#ifdef CONFIG_PM_RUNTIME

Expand Down Expand Up @@ -949,23 +926,10 @@ int __weak platform_pm_runtime_idle(struct device *dev)
#endif /* !CONFIG_PM_RUNTIME */

static const struct dev_pm_ops platform_dev_pm_ops = {
.prepare = platform_pm_prepare,
.complete = platform_pm_complete,
.suspend = platform_pm_suspend,
.resume = platform_pm_resume,
.freeze = platform_pm_freeze,
.thaw = platform_pm_thaw,
.poweroff = platform_pm_poweroff,
.restore = platform_pm_restore,
.suspend_noirq = platform_pm_suspend_noirq,
.resume_noirq = platform_pm_resume_noirq,
.freeze_noirq = platform_pm_freeze_noirq,
.thaw_noirq = platform_pm_thaw_noirq,
.poweroff_noirq = platform_pm_poweroff_noirq,
.restore_noirq = platform_pm_restore_noirq,
.runtime_suspend = platform_pm_runtime_suspend,
.runtime_resume = platform_pm_runtime_resume,
.runtime_idle = platform_pm_runtime_idle,
USE_PLATFORM_PM_SLEEP_OPS
};

struct bus_type platform_bus_type = {
Expand Down
60 changes: 60 additions & 0 deletions trunk/include/linux/platform_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,64 @@ static inline char *early_platform_driver_setup_func(void) \
}
#endif /* MODULE */

#ifdef CONFIG_PM_SLEEP
extern int platform_pm_prepare(struct device *dev);
extern void platform_pm_complete(struct device *dev);
#else
#define platform_pm_prepare NULL
#define platform_pm_complete NULL
#endif

#ifdef CONFIG_SUSPEND
extern int platform_pm_suspend(struct device *dev);
extern int platform_pm_suspend_noirq(struct device *dev);
extern int platform_pm_resume(struct device *dev);
extern int platform_pm_resume_noirq(struct device *dev);
#else
#define platform_pm_suspend NULL
#define platform_pm_resume NULL
#define platform_pm_suspend_noirq NULL
#define platform_pm_resume_noirq NULL
#endif

#ifdef CONFIG_HIBERNATE_CALLBACKS
extern int platform_pm_freeze(struct device *dev);
extern int platform_pm_freeze_noirq(struct device *dev);
extern int platform_pm_thaw(struct device *dev);
extern int platform_pm_thaw_noirq(struct device *dev);
extern int platform_pm_poweroff(struct device *dev);
extern int platform_pm_poweroff_noirq(struct device *dev);
extern int platform_pm_restore(struct device *dev);
extern int platform_pm_restore_noirq(struct device *dev);
#else
#define platform_pm_freeze NULL
#define platform_pm_thaw NULL
#define platform_pm_poweroff NULL
#define platform_pm_restore NULL
#define platform_pm_freeze_noirq NULL
#define platform_pm_thaw_noirq NULL
#define platform_pm_poweroff_noirq NULL
#define platform_pm_restore_noirq NULL
#endif

#ifdef CONFIG_PM_SLEEP
#define USE_PLATFORM_PM_SLEEP_OPS \
.prepare = platform_pm_prepare, \
.complete = platform_pm_complete, \
.suspend = platform_pm_suspend, \
.resume = platform_pm_resume, \
.freeze = platform_pm_freeze, \
.thaw = platform_pm_thaw, \
.poweroff = platform_pm_poweroff, \
.restore = platform_pm_restore, \
.suspend_noirq = platform_pm_suspend_noirq, \
.resume_noirq = platform_pm_resume_noirq, \
.freeze_noirq = platform_pm_freeze_noirq, \
.thaw_noirq = platform_pm_thaw_noirq, \
.poweroff_noirq = platform_pm_poweroff_noirq, \
.restore_noirq = platform_pm_restore_noirq,
#else
#define USE_PLATFORM_PM_SLEEP_OPS
#endif

#endif /* _PLATFORM_DEVICE_H_ */

0 comments on commit 01187e0

Please sign in to comment.