aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/power.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-09-29 16:29:44 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-10-04 15:54:26 -0400
commit1a9a91525d806f2b3bd8b57b963755a96fd36ce2 (patch)
tree511db2ab0871872bce759d35b7ffd22b9d7fc3f5 /drivers/base/power/power.h
parentb66213cdb002b08b29603d488c451dfe25e2ca20 (diff)
PM / QoS: Add function dev_pm_qos_read_value() (v3)
To read the current PM QoS value for a given device we need to make sure that the device's power.constraints object won't be removed while we're doing that. For this reason, put the operation under dev->power.lock and acquire the lock around the initialization and removal of power.constraints. Moreover, since we're using the value of power.constraints to determine whether or not the object is present, the power.constraints_state field isn't necessary any more and may be removed. However, dev_pm_qos_add_request() needs to check if the device is being removed from the system before allocating a new PM QoS constraints object for it, so make it use the power.power_state field of struct device for this purpose. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base/power/power.h')
-rw-r--r--drivers/base/power/power.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index f2a25f18fde7..9bf62323aaf3 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -1,3 +1,5 @@
1#include <linux/pm_qos.h>
2
1#ifdef CONFIG_PM_RUNTIME 3#ifdef CONFIG_PM_RUNTIME
2 4
3extern void pm_runtime_init(struct device *dev); 5extern void pm_runtime_init(struct device *dev);
@@ -35,15 +37,21 @@ extern void device_pm_move_last(struct device *);
35static inline void device_pm_init(struct device *dev) 37static inline void device_pm_init(struct device *dev)
36{ 38{
37 spin_lock_init(&dev->power.lock); 39 spin_lock_init(&dev->power.lock);
40 dev->power.power_state = PMSG_INVALID;
38 pm_runtime_init(dev); 41 pm_runtime_init(dev);
39} 42}
40 43
44static inline void device_pm_add(struct device *dev)
45{
46 dev_pm_qos_constraints_init(dev);
47}
48
41static inline void device_pm_remove(struct device *dev) 49static inline void device_pm_remove(struct device *dev)
42{ 50{
51 dev_pm_qos_constraints_destroy(dev);
43 pm_runtime_remove(dev); 52 pm_runtime_remove(dev);
44} 53}
45 54
46static inline void device_pm_add(struct device *dev) {}
47static inline void device_pm_move_before(struct device *deva, 55static inline void device_pm_move_before(struct device *deva,
48 struct device *devb) {} 56 struct device *devb) {}
49static inline void device_pm_move_after(struct device *deva, 57static inline void device_pm_move_after(struct device *deva,