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: PM QOS update fix
  Freezer / cgroup freezer: Update stale locking comments
  PM / platform_bus: Allow runtime PM by default
  i2c: Fix bus-level power management callbacks
  PM QOS update
  PM / Hibernate: Fix block_io.c printk warning
  PM / Hibernate: Group swap ops
  PM / Hibernate: Move the first_sector out of swsusp_write
  PM / Hibernate: Separate block_io
  PM / Hibernate: Snapshot cleanup
  FS / libfs: Implement simple_write_to_buffer
  PM / Hibernate: document open(/dev/snapshot) side effects
  PM / Runtime: Add sysfs debug files
  PM: Improve device power management document
  PM: Update device power management document
  PM: Allow runtime_suspend methods to call pm_schedule_suspend()
  PM: pm_wakeup - switch to using bool
This commit is contained in:
Linus Torvalds 2010-05-20 09:03:55 -07:00
commit 46ee964509
31 changed files with 1251 additions and 949 deletions

View file

@ -2362,6 +2362,8 @@ extern void simple_release_fs(struct vfsmount **mount, int *count);
extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
loff_t *ppos, const void *from, size_t available);
extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
const void __user *from, size_t count);
extern int simple_fsync(struct file *, struct dentry *, int);

View file

@ -31,6 +31,7 @@
#include <linux/if_link.h>
#ifdef __KERNEL__
#include <linux/pm_qos_params.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/mm.h>
@ -711,6 +712,9 @@ struct net_device {
* the interface.
*/
char name[IFNAMSIZ];
struct pm_qos_request_list *pm_qos_req;
/* device name hash chain */
struct hlist_node name_hlist;
/* snmp alias */

View file

@ -14,12 +14,14 @@
#define PM_QOS_NUM_CLASSES 4
#define PM_QOS_DEFAULT_VALUE -1
int pm_qos_add_requirement(int qos, char *name, s32 value);
int pm_qos_update_requirement(int qos, char *name, s32 new_value);
void pm_qos_remove_requirement(int qos, char *name);
struct pm_qos_request_list;
int pm_qos_requirement(int qos);
struct pm_qos_request_list *pm_qos_add_request(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);
int pm_qos_add_notifier(int qos, struct notifier_block *notifier);
int pm_qos_remove_notifier(int qos, struct notifier_block *notifier);
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);

View file

@ -30,6 +30,9 @@ extern void pm_runtime_enable(struct device *dev);
extern void __pm_runtime_disable(struct device *dev, bool check_resume);
extern void pm_runtime_allow(struct device *dev);
extern void pm_runtime_forbid(struct device *dev);
extern int pm_generic_runtime_idle(struct device *dev);
extern int pm_generic_runtime_suspend(struct device *dev);
extern int pm_generic_runtime_resume(struct device *dev);
static inline bool pm_children_suspended(struct device *dev)
{
@ -96,6 +99,10 @@ static inline bool device_run_wake(struct device *dev) { return false; }
static inline void device_set_run_wake(struct device *dev, bool enable) {}
static inline bool pm_runtime_suspended(struct device *dev) { return false; }
static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
#endif /* !CONFIG_PM_RUNTIME */
static inline int pm_runtime_get(struct device *dev)

View file

@ -25,32 +25,34 @@
# error "please don't include this file directly"
#endif
#include <linux/types.h>
#ifdef CONFIG_PM
/* changes to device_may_wakeup take effect on the next pm state change.
* by default, devices should wakeup if they can.
*/
static inline void device_init_wakeup(struct device *dev, int val)
static inline void device_init_wakeup(struct device *dev, bool val)
{
dev->power.can_wakeup = dev->power.should_wakeup = !!val;
dev->power.can_wakeup = dev->power.should_wakeup = val;
}
static inline void device_set_wakeup_capable(struct device *dev, int val)
static inline void device_set_wakeup_capable(struct device *dev, bool capable)
{
dev->power.can_wakeup = !!val;
dev->power.can_wakeup = capable;
}
static inline int device_can_wakeup(struct device *dev)
static inline bool device_can_wakeup(struct device *dev)
{
return dev->power.can_wakeup;
}
static inline void device_set_wakeup_enable(struct device *dev, int val)
static inline void device_set_wakeup_enable(struct device *dev, bool enable)
{
dev->power.should_wakeup = !!val;
dev->power.should_wakeup = enable;
}
static inline int device_may_wakeup(struct device *dev)
static inline bool device_may_wakeup(struct device *dev)
{
return dev->power.can_wakeup && dev->power.should_wakeup;
}
@ -58,20 +60,28 @@ static inline int device_may_wakeup(struct device *dev)
#else /* !CONFIG_PM */
/* For some reason the next two routines work even without CONFIG_PM */
static inline void device_init_wakeup(struct device *dev, int val)
static inline void device_init_wakeup(struct device *dev, bool val)
{
dev->power.can_wakeup = !!val;
dev->power.can_wakeup = val;
}
static inline void device_set_wakeup_capable(struct device *dev, int val) { }
static inline void device_set_wakeup_capable(struct device *dev, bool capable)
{
}
static inline int device_can_wakeup(struct device *dev)
static inline bool device_can_wakeup(struct device *dev)
{
return dev->power.can_wakeup;
}
#define device_set_wakeup_enable(dev, val) do {} while (0)
#define device_may_wakeup(dev) 0
static inline void device_set_wakeup_enable(struct device *dev, bool enable)
{
}
static inline bool device_may_wakeup(struct device *dev)
{
return false;
}
#endif /* !CONFIG_PM */