Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6: PM / Runtime: Add runtime PM statistics (v3) PM / Runtime: Make runtime_status attribute not debug-only (v. 2) PM: Do not use dynamically allocated objects in pm_wakeup_event() PM / Suspend: Fix ordering of calls in suspend error paths PM / Hibernate: Fix snapshot error code path PM / Hibernate: Fix hibernation_platform_enter() pm_qos: Get rid of the allocation in pm_qos_add_request() pm_qos: Reimplement using plists plist: Add plist_last PM: Make it possible to avoid races between wakeup and system sleep PNPACPI: Add support for remote wakeup PM: describe kernel policy regarding wakeup defaults (v. 2) PM / Hibernate: Fix typos in comments in kernel/power/swap.c
This commit is contained in:
commit
f46e9913fa
29 changed files with 734 additions and 188 deletions
|
|
@ -779,7 +779,7 @@ struct net_device {
|
|||
*/
|
||||
char name[IFNAMSIZ];
|
||||
|
||||
struct pm_qos_request_list *pm_qos_req;
|
||||
struct pm_qos_request_list pm_qos_req;
|
||||
|
||||
/* device name hash chain */
|
||||
struct hlist_node name_hlist;
|
||||
|
|
|
|||
|
|
@ -259,6 +259,23 @@ static inline int plist_node_empty(const struct plist_node *node)
|
|||
container_of(plist_first(head), type, member)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* plist_last_entry - get the struct for the last entry
|
||||
* @head: the &struct plist_head pointer
|
||||
* @type: the type of the struct this is embedded in
|
||||
* @member: the name of the list_struct within the struct
|
||||
*/
|
||||
#ifdef CONFIG_DEBUG_PI_LIST
|
||||
# define plist_last_entry(head, type, member) \
|
||||
({ \
|
||||
WARN_ON(plist_head_empty(head)); \
|
||||
container_of(plist_last(head), type, member); \
|
||||
})
|
||||
#else
|
||||
# define plist_last_entry(head, type, member) \
|
||||
container_of(plist_last(head), type, member)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* plist_first - return the first node (and thus, highest priority)
|
||||
* @head: the &struct plist_head pointer
|
||||
|
|
@ -271,4 +288,16 @@ static inline struct plist_node *plist_first(const struct plist_head *head)
|
|||
struct plist_node, plist.node_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* plist_last - return the last node (and thus, lowest priority)
|
||||
* @head: the &struct plist_head pointer
|
||||
*
|
||||
* Assumes the plist is _not_ empty.
|
||||
*/
|
||||
static inline struct plist_node *plist_last(const struct plist_head *head)
|
||||
{
|
||||
return list_entry(head->node_list.prev,
|
||||
struct plist_node, plist.node_list);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -457,6 +457,7 @@ struct dev_pm_info {
|
|||
#ifdef CONFIG_PM_SLEEP
|
||||
struct list_head entry;
|
||||
struct completion completion;
|
||||
unsigned long wakeup_count;
|
||||
#endif
|
||||
#ifdef CONFIG_PM_RUNTIME
|
||||
struct timer_list suspend_timer;
|
||||
|
|
@ -476,9 +477,15 @@ struct dev_pm_info {
|
|||
enum rpm_request request;
|
||||
enum rpm_status runtime_status;
|
||||
int runtime_error;
|
||||
unsigned long active_jiffies;
|
||||
unsigned long suspended_jiffies;
|
||||
unsigned long accounting_timestamp;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern void update_pm_runtime_accounting(struct device *dev);
|
||||
|
||||
|
||||
/*
|
||||
* The PM_EVENT_ messages are also used by drivers implementing the legacy
|
||||
* suspend framework, based on the ->suspend() and ->resume() callbacks common
|
||||
|
|
@ -552,6 +559,11 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
|
|||
} while (0)
|
||||
|
||||
extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
|
||||
|
||||
/* drivers/base/power/wakeup.c */
|
||||
extern void pm_wakeup_event(struct device *dev, unsigned int msec);
|
||||
extern void pm_stay_awake(struct device *dev);
|
||||
extern void pm_relax(void);
|
||||
#else /* !CONFIG_PM_SLEEP */
|
||||
|
||||
#define device_pm_lock() do {} while (0)
|
||||
|
|
@ -565,6 +577,10 @@ static inline int dpm_suspend_start(pm_message_t state)
|
|||
#define suspend_report_result(fn, ret) do {} while (0)
|
||||
|
||||
static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
|
||||
|
||||
static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
|
||||
static inline void pm_stay_awake(struct device *dev) {}
|
||||
static inline void pm_relax(void) {}
|
||||
#endif /* !CONFIG_PM_SLEEP */
|
||||
|
||||
/* How to reorder dpm_list after device_move() */
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#ifndef _LINUX_PM_QOS_PARAMS_H
|
||||
#define _LINUX_PM_QOS_PARAMS_H
|
||||
/* interface for the pm_qos_power infrastructure of the linux kernel.
|
||||
*
|
||||
* Mark Gross <mgross@linux.intel.com>
|
||||
*/
|
||||
#include <linux/list.h>
|
||||
#include <linux/plist.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/miscdevice.h>
|
||||
|
||||
|
|
@ -14,9 +16,12 @@
|
|||
#define PM_QOS_NUM_CLASSES 4
|
||||
#define PM_QOS_DEFAULT_VALUE -1
|
||||
|
||||
struct pm_qos_request_list;
|
||||
struct pm_qos_request_list {
|
||||
struct plist_node list;
|
||||
int pm_qos_class;
|
||||
};
|
||||
|
||||
struct pm_qos_request_list *pm_qos_add_request(int pm_qos_class, s32 value);
|
||||
void pm_qos_add_request(struct pm_qos_request_list *l, int pm_qos_class, s32 value);
|
||||
void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
|
||||
s32 new_value);
|
||||
void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
|
||||
|
|
@ -24,4 +29,6 @@ void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
|
|||
int pm_qos_request(int pm_qos_class);
|
||||
int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
|
||||
int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
|
||||
int pm_qos_request_active(struct pm_qos_request_list *req);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,8 +29,11 @@
|
|||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
/* changes to device_may_wakeup take effect on the next pm state change.
|
||||
* by default, devices should wakeup if they can.
|
||||
/* Changes to device_may_wakeup take effect on the next pm state change.
|
||||
*
|
||||
* By default, most devices should leave wakeup disabled. The exceptions
|
||||
* are devices that everyone expects to be wakeup sources: keyboards,
|
||||
* power buttons, possibly network interfaces, etc.
|
||||
*/
|
||||
static inline void device_init_wakeup(struct device *dev, bool val)
|
||||
{
|
||||
|
|
@ -59,7 +62,7 @@ static inline bool device_may_wakeup(struct device *dev)
|
|||
|
||||
#else /* !CONFIG_PM */
|
||||
|
||||
/* For some reason the next two routines work even without CONFIG_PM */
|
||||
/* For some reason the following routines work even without CONFIG_PM */
|
||||
static inline void device_init_wakeup(struct device *dev, bool val)
|
||||
{
|
||||
dev->power.can_wakeup = val;
|
||||
|
|
@ -67,6 +70,7 @@ static inline void device_init_wakeup(struct device *dev, bool val)
|
|||
|
||||
static inline void device_set_wakeup_capable(struct device *dev, bool capable)
|
||||
{
|
||||
dev->power.can_wakeup = capable;
|
||||
}
|
||||
|
||||
static inline bool device_can_wakeup(struct device *dev)
|
||||
|
|
|
|||
|
|
@ -414,6 +414,7 @@ struct pnp_protocol {
|
|||
int (*disable) (struct pnp_dev *dev);
|
||||
|
||||
/* protocol specific suspend/resume */
|
||||
bool (*can_wakeup) (struct pnp_dev *dev);
|
||||
int (*suspend) (struct pnp_dev * dev, pm_message_t state);
|
||||
int (*resume) (struct pnp_dev * dev);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,14 +61,15 @@ typedef int __bitwise suspend_state_t;
|
|||
* before device drivers' late suspend callbacks are executed. It returns
|
||||
* 0 on success or a negative error code otherwise, in which case the
|
||||
* system cannot enter the desired sleep state (@prepare_late(), @enter(),
|
||||
* @wake(), and @finish() will not be called in that case).
|
||||
* and @wake() will not be called in that case).
|
||||
*
|
||||
* @prepare_late: Finish preparing the platform for entering the system sleep
|
||||
* state indicated by @begin().
|
||||
* @prepare_late is called before disabling nonboot CPUs and after
|
||||
* device drivers' late suspend callbacks have been executed. It returns
|
||||
* 0 on success or a negative error code otherwise, in which case the
|
||||
* system cannot enter the desired sleep state (@enter() and @wake()).
|
||||
* system cannot enter the desired sleep state (@enter() will not be
|
||||
* executed).
|
||||
*
|
||||
* @enter: Enter the system sleep state indicated by @begin() or represented by
|
||||
* the argument if @begin() is not implemented.
|
||||
|
|
@ -81,14 +82,15 @@ typedef int __bitwise suspend_state_t;
|
|||
* resume callbacks are executed.
|
||||
* This callback is optional, but should be implemented by the platforms
|
||||
* that implement @prepare_late(). If implemented, it is always called
|
||||
* after @enter(), even if @enter() fails.
|
||||
* after @prepare_late and @enter(), even if one of them fails.
|
||||
*
|
||||
* @finish: Finish wake-up of the platform.
|
||||
* @finish is called right prior to calling device drivers' regular suspend
|
||||
* callbacks.
|
||||
* This callback is optional, but should be implemented by the platforms
|
||||
* that implement @prepare(). If implemented, it is always called after
|
||||
* @enter() and @wake(), if implemented, even if any of them fails.
|
||||
* @enter() and @wake(), even if any of them fails. It is executed after
|
||||
* a failing @prepare.
|
||||
*
|
||||
* @end: Called by the PM core right after resuming devices, to indicate to
|
||||
* the platform that the system has returned to the working state or
|
||||
|
|
@ -286,6 +288,13 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
|
|||
{ .notifier_call = fn, .priority = pri }; \
|
||||
register_pm_notifier(&fn##_nb); \
|
||||
}
|
||||
|
||||
/* drivers/base/power/wakeup.c */
|
||||
extern bool events_check_enabled;
|
||||
|
||||
extern bool pm_check_wakeup_events(void);
|
||||
extern bool pm_get_wakeup_count(unsigned long *count);
|
||||
extern bool pm_save_wakeup_count(unsigned long count);
|
||||
#else /* !CONFIG_PM_SLEEP */
|
||||
|
||||
static inline int register_pm_notifier(struct notifier_block *nb)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue