aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_qos.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 /include/linux/pm_qos.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 'include/linux/pm_qos.h')
-rw-r--r--include/linux/pm_qos.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index ca7bd3f98cb4..83b0ea302a80 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -7,6 +7,7 @@
7#include <linux/plist.h> 7#include <linux/plist.h>
8#include <linux/notifier.h> 8#include <linux/notifier.h>
9#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
10#include <linux/device.h>
10 11
11#define PM_QOS_RESERVED 0 12#define PM_QOS_RESERVED 0
12#define PM_QOS_CPU_DMA_LATENCY 1 13#define PM_QOS_CPU_DMA_LATENCY 1
@@ -77,6 +78,7 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
77int pm_qos_request_active(struct pm_qos_request *req); 78int pm_qos_request_active(struct pm_qos_request *req);
78s32 pm_qos_read_value(struct pm_qos_constraints *c); 79s32 pm_qos_read_value(struct pm_qos_constraints *c);
79 80
81s32 dev_pm_qos_read_value(struct device *dev);
80int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, 82int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
81 s32 value); 83 s32 value);
82int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value); 84int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value);
@@ -117,6 +119,8 @@ static inline int pm_qos_request_active(struct pm_qos_request *req)
117static inline s32 pm_qos_read_value(struct pm_qos_constraints *c) 119static inline s32 pm_qos_read_value(struct pm_qos_constraints *c)
118 { return 0; } 120 { return 0; }
119 121
122static inline s32 dev_pm_qos_read_value(struct device *dev)
123 { return 0; }
120static inline int dev_pm_qos_add_request(struct device *dev, 124static inline int dev_pm_qos_add_request(struct device *dev,
121 struct dev_pm_qos_request *req, 125 struct dev_pm_qos_request *req,
122 s32 value) 126 s32 value)
@@ -139,9 +143,13 @@ static inline int dev_pm_qos_remove_global_notifier(
139 struct notifier_block *notifier) 143 struct notifier_block *notifier)
140 { return 0; } 144 { return 0; }
141static inline void dev_pm_qos_constraints_init(struct device *dev) 145static inline void dev_pm_qos_constraints_init(struct device *dev)
142 { return; } 146{
147 dev->power.power_state = PMSG_ON;
148}
143static inline void dev_pm_qos_constraints_destroy(struct device *dev) 149static inline void dev_pm_qos_constraints_destroy(struct device *dev)
144 { return; } 150{
151 dev->power.power_state = PMSG_INVALID;
152}
145#endif 153#endif
146 154
147#endif 155#endif