mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-03 21:01:50 +00:00
PM: Convert wakeup flag accessors to inline functions
This patch (as1058) improves the wakeup macros in include/linux/pm.h. All but the trivial ones are converted to inline routines, which requires moving them to a separate header file since they depend on the definition of struct device. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
d288e47c47
commit
9a3df1f7de
3 changed files with 94 additions and 45 deletions
|
@ -212,54 +212,10 @@ static inline int device_suspend(pm_message_t state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define suspend_report_result(fn, ret) do { } while (0)
|
||||
#define suspend_report_result(fn, ret) do {} while (0)
|
||||
|
||||
#endif /* !CONFIG_PM_SLEEP */
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
#define device_set_wakeup_enable(dev,val) \
|
||||
((dev)->power.should_wakeup = !!(val))
|
||||
#define device_may_wakeup(dev) \
|
||||
(device_can_wakeup(dev) && (dev)->power.should_wakeup)
|
||||
|
||||
/*
|
||||
* Platform hook to activate device wakeup capability, if that's not already
|
||||
* handled by enable_irq_wake() etc.
|
||||
* Returns zero on success, else negative errno
|
||||
*/
|
||||
extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
|
||||
|
||||
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
|
||||
{
|
||||
if (platform_enable_wakeup)
|
||||
return (*platform_enable_wakeup)(dev, is_on);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !CONFIG_PM */
|
||||
|
||||
#define device_set_wakeup_enable(dev,val) do{}while(0)
|
||||
#define device_may_wakeup(dev) (0)
|
||||
|
||||
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_PM */
|
||||
|
||||
/* changes to device_may_wakeup take effect on the next pm state change.
|
||||
* by default, devices should wakeup if they can.
|
||||
*/
|
||||
#define device_can_wakeup(dev) \
|
||||
((dev)->power.can_wakeup)
|
||||
#define device_init_wakeup(dev,val) \
|
||||
do { \
|
||||
device_can_wakeup(dev) = !!(val); \
|
||||
device_set_wakeup_enable(dev,val); \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* Global Power Management flags
|
||||
* Used to keep APM and ACPI from both being active
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue