4545#include <linux/uaccess.h>
4646
4747/*
48- * locking rule: all changes to requests or notifiers lists
48+ * locking rule: all changes to constraints or notifiers lists
4949 * or pm_qos_object list and pm_qos_objects need to happen with pm_qos_lock
5050 * held, taken with _irqsave. One lock to rule them all
5151 */
@@ -60,7 +60,7 @@ enum pm_qos_type {
6060 * types linux supports for 32 bit quantites
6161 */
6262struct pm_qos_object {
63- struct plist_head requests ;
63+ struct plist_head constraints ;
6464 struct blocking_notifier_head * notifiers ;
6565 struct miscdevice pm_qos_power_miscdev ;
6666 char * name ;
@@ -74,7 +74,7 @@ static DEFINE_SPINLOCK(pm_qos_lock);
7474static struct pm_qos_object null_pm_qos ;
7575static BLOCKING_NOTIFIER_HEAD (cpu_dma_lat_notifier );
7676static struct pm_qos_object cpu_dma_pm_qos = {
77- .requests = PLIST_HEAD_INIT (cpu_dma_pm_qos .requests ),
77+ .constraints = PLIST_HEAD_INIT (cpu_dma_pm_qos .constraints ),
7878 .notifiers = & cpu_dma_lat_notifier ,
7979 .name = "cpu_dma_latency" ,
8080 .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE ,
@@ -84,7 +84,7 @@ static struct pm_qos_object cpu_dma_pm_qos = {
8484
8585static BLOCKING_NOTIFIER_HEAD (network_lat_notifier );
8686static struct pm_qos_object network_lat_pm_qos = {
87- .requests = PLIST_HEAD_INIT (network_lat_pm_qos .requests ),
87+ .constraints = PLIST_HEAD_INIT (network_lat_pm_qos .constraints ),
8888 .notifiers = & network_lat_notifier ,
8989 .name = "network_latency" ,
9090 .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE ,
@@ -95,7 +95,7 @@ static struct pm_qos_object network_lat_pm_qos = {
9595
9696static BLOCKING_NOTIFIER_HEAD (network_throughput_notifier );
9797static struct pm_qos_object network_throughput_pm_qos = {
98- .requests = PLIST_HEAD_INIT (network_throughput_pm_qos .requests ),
98+ .constraints = PLIST_HEAD_INIT (network_throughput_pm_qos .constraints ),
9999 .notifiers = & network_throughput_notifier ,
100100 .name = "network_throughput" ,
101101 .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE ,
@@ -129,15 +129,15 @@ static const struct file_operations pm_qos_power_fops = {
129129/* unlocked internal variant */
130130static inline int pm_qos_get_value (struct pm_qos_object * o )
131131{
132- if (plist_head_empty (& o -> requests ))
132+ if (plist_head_empty (& o -> constraints ))
133133 return o -> default_value ;
134134
135135 switch (o -> type ) {
136136 case PM_QOS_MIN :
137- return plist_first (& o -> requests )-> prio ;
137+ return plist_first (& o -> constraints )-> prio ;
138138
139139 case PM_QOS_MAX :
140- return plist_last (& o -> requests )-> prio ;
140+ return plist_last (& o -> constraints )-> prio ;
141141
142142 default :
143143 /* runtime check for not using enum */
@@ -170,13 +170,13 @@ static void update_target(struct pm_qos_object *o, struct plist_node *node,
170170 * with new value and add, then see if the extremal
171171 * changed
172172 */
173- plist_del (node , & o -> requests );
173+ plist_del (node , & o -> constraints );
174174 plist_node_init (node , value );
175- plist_add (node , & o -> requests );
175+ plist_add (node , & o -> constraints );
176176 } else if (del ) {
177- plist_del (node , & o -> requests );
177+ plist_del (node , & o -> constraints );
178178 } else {
179- plist_add (node , & o -> requests );
179+ plist_add (node , & o -> constraints );
180180 }
181181 curr_value = pm_qos_get_value (o );
182182 pm_qos_set_value (o , curr_value );
@@ -222,105 +222,105 @@ int pm_qos_request(int pm_qos_class)
222222}
223223EXPORT_SYMBOL_GPL (pm_qos_request );
224224
225- int pm_qos_request_active (struct pm_qos_request_list * req )
225+ int pm_qos_request_active (struct pm_qos_request * req )
226226{
227227 return req -> pm_qos_class != 0 ;
228228}
229229EXPORT_SYMBOL_GPL (pm_qos_request_active );
230230
231231/**
232232 * pm_qos_add_request - inserts new qos request into the list
233- * @dep : pointer to a preallocated handle
233+ * @req : pointer to a preallocated handle
234234 * @pm_qos_class: identifies which list of qos request to use
235235 * @value: defines the qos request
236236 *
237237 * This function inserts a new entry in the pm_qos_class list of requested qos
238238 * performance characteristics. It recomputes the aggregate QoS expectations
239- * for the pm_qos_class of parameters and initializes the pm_qos_request_list
239+ * for the pm_qos_class of parameters and initializes the pm_qos_request
240240 * handle. Caller needs to save this handle for later use in updates and
241241 * removal.
242242 */
243243
244- void pm_qos_add_request (struct pm_qos_request_list * dep ,
244+ void pm_qos_add_request (struct pm_qos_request * req ,
245245 int pm_qos_class , s32 value )
246246{
247247 struct pm_qos_object * o = pm_qos_array [pm_qos_class ];
248248 int new_value ;
249249
250- if (pm_qos_request_active (dep )) {
250+ if (pm_qos_request_active (req )) {
251251 WARN (1 , KERN_ERR "pm_qos_add_request() called for already added request\n" );
252252 return ;
253253 }
254254 if (value == PM_QOS_DEFAULT_VALUE )
255255 new_value = o -> default_value ;
256256 else
257257 new_value = value ;
258- plist_node_init (& dep -> list , new_value );
259- dep -> pm_qos_class = pm_qos_class ;
260- update_target (o , & dep -> list , 0 , PM_QOS_DEFAULT_VALUE );
258+ plist_node_init (& req -> node , new_value );
259+ req -> pm_qos_class = pm_qos_class ;
260+ update_target (o , & req -> node , 0 , PM_QOS_DEFAULT_VALUE );
261261}
262262EXPORT_SYMBOL_GPL (pm_qos_add_request );
263263
264264/**
265265 * pm_qos_update_request - modifies an existing qos request
266- * @pm_qos_req : handle to list element holding a pm_qos request to use
266+ * @req : handle to list element holding a pm_qos request to use
267267 * @value: defines the qos request
268268 *
269269 * Updates an existing qos request for the pm_qos_class of parameters along
270270 * with updating the target pm_qos_class value.
271271 *
272272 * Attempts are made to make this code callable on hot code paths.
273273 */
274- void pm_qos_update_request (struct pm_qos_request_list * pm_qos_req ,
274+ void pm_qos_update_request (struct pm_qos_request * req ,
275275 s32 new_value )
276276{
277277 s32 temp ;
278278 struct pm_qos_object * o ;
279279
280- if (!pm_qos_req ) /*guard against callers passing in null */
280+ if (!req ) /*guard against callers passing in null */
281281 return ;
282282
283- if (!pm_qos_request_active (pm_qos_req )) {
283+ if (!pm_qos_request_active (req )) {
284284 WARN (1 , KERN_ERR "pm_qos_update_request() called for unknown object\n" );
285285 return ;
286286 }
287287
288- o = pm_qos_array [pm_qos_req -> pm_qos_class ];
288+ o = pm_qos_array [req -> pm_qos_class ];
289289
290290 if (new_value == PM_QOS_DEFAULT_VALUE )
291291 temp = o -> default_value ;
292292 else
293293 temp = new_value ;
294294
295- if (temp != pm_qos_req -> list .prio )
296- update_target (o , & pm_qos_req -> list , 0 , temp );
295+ if (temp != req -> node .prio )
296+ update_target (o , & req -> node , 0 , temp );
297297}
298298EXPORT_SYMBOL_GPL (pm_qos_update_request );
299299
300300/**
301301 * pm_qos_remove_request - modifies an existing qos request
302- * @pm_qos_req : handle to request list element
302+ * @req : handle to request list element
303303 *
304- * Will remove pm qos request from the list of requests and
304+ * Will remove pm qos request from the list of constraints and
305305 * recompute the current target value for the pm_qos_class. Call this
306306 * on slow code paths.
307307 */
308- void pm_qos_remove_request (struct pm_qos_request_list * pm_qos_req )
308+ void pm_qos_remove_request (struct pm_qos_request * req )
309309{
310310 struct pm_qos_object * o ;
311311
312- if (pm_qos_req == NULL )
312+ if (req == NULL )
313313 return ;
314314 /* silent return to keep pcm code cleaner */
315315
316- if (!pm_qos_request_active (pm_qos_req )) {
316+ if (!pm_qos_request_active (req )) {
317317 WARN (1 , KERN_ERR "pm_qos_remove_request() called for unknown object\n" );
318318 return ;
319319 }
320320
321- o = pm_qos_array [pm_qos_req -> pm_qos_class ];
322- update_target (o , & pm_qos_req -> list , 1 , PM_QOS_DEFAULT_VALUE );
323- memset (pm_qos_req , 0 , sizeof (* pm_qos_req ));
321+ o = pm_qos_array [req -> pm_qos_class ];
322+ update_target (o , & req -> node , 1 , PM_QOS_DEFAULT_VALUE );
323+ memset (req , 0 , sizeof (* req ));
324324}
325325EXPORT_SYMBOL_GPL (pm_qos_remove_request );
326326
@@ -368,7 +368,7 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp)
368368
369369 pm_qos_class = find_pm_qos_object_by_minor (iminor (inode ));
370370 if (pm_qos_class >= 0 ) {
371- struct pm_qos_request_list * req = kzalloc (sizeof (* req ), GFP_KERNEL );
371+ struct pm_qos_request * req = kzalloc (sizeof (* req ), GFP_KERNEL );
372372 if (!req )
373373 return - ENOMEM ;
374374
@@ -383,7 +383,7 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp)
383383
384384static int pm_qos_power_release (struct inode * inode , struct file * filp )
385385{
386- struct pm_qos_request_list * req ;
386+ struct pm_qos_request * req ;
387387
388388 req = filp -> private_data ;
389389 pm_qos_remove_request (req );
@@ -399,14 +399,14 @@ static ssize_t pm_qos_power_read(struct file *filp, char __user *buf,
399399 s32 value ;
400400 unsigned long flags ;
401401 struct pm_qos_object * o ;
402- struct pm_qos_request_list * pm_qos_req = filp -> private_data ;
402+ struct pm_qos_request * req = filp -> private_data ;
403403
404- if (!pm_qos_req )
404+ if (!req )
405405 return - EINVAL ;
406- if (!pm_qos_request_active (pm_qos_req ))
406+ if (!pm_qos_request_active (req ))
407407 return - EINVAL ;
408408
409- o = pm_qos_array [pm_qos_req -> pm_qos_class ];
409+ o = pm_qos_array [req -> pm_qos_class ];
410410 spin_lock_irqsave (& pm_qos_lock , flags );
411411 value = pm_qos_get_value (o );
412412 spin_unlock_irqrestore (& pm_qos_lock , flags );
@@ -418,7 +418,7 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
418418 size_t count , loff_t * f_pos )
419419{
420420 s32 value ;
421- struct pm_qos_request_list * pm_qos_req ;
421+ struct pm_qos_request * req ;
422422
423423 if (count == sizeof (s32 )) {
424424 if (copy_from_user (& value , buf , sizeof (s32 )))
@@ -449,8 +449,8 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
449449 return - EINVAL ;
450450 }
451451
452- pm_qos_req = filp -> private_data ;
453- pm_qos_update_request (pm_qos_req , value );
452+ req = filp -> private_data ;
453+ pm_qos_update_request (req , value );
454454
455455 return count ;
456456}
0 commit comments