Commit cc74998618a66d34651c784dd02412614c3e81cc

Authored by Jean Pihet
Committed by Rafael J. Wysocki
1 parent e8db0be124

PM QoS: Minor clean-ups

- Misc fixes to improve code readability:
  * rename struct pm_qos_request_list to struct pm_qos_request,
  * rename pm_qos_req parameter to req in internal code,
    consistenly use req in the API parameters,
  * update the in-kernel API callers to the new parameters names,
  * rename of fields names (requests, list, node, constraints)

Signed-off-by: Jean Pihet <j-pihet@ti.com>
Acked-by: markgross <markgross@thegnar.org>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Showing 6 changed files with 59 additions and 59 deletions Side-by-side Diff

drivers/media/video/via-camera.c
... ... @@ -69,7 +69,7 @@
69 69 struct mutex lock;
70 70 enum viacam_opstate opstate;
71 71 unsigned long flags;
72   - struct pm_qos_request_list qos_request;
  72 + struct pm_qos_request qos_request;
73 73 /*
74 74 * GPIO info for power/reset management
75 75 */
drivers/net/wireless/ipw2x00/ipw2100.c
... ... @@ -174,7 +174,7 @@
174 174 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver"
175 175 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation"
176 176  
177   -static struct pm_qos_request_list ipw2100_pm_qos_req;
  177 +static struct pm_qos_request ipw2100_pm_qos_req;
178 178  
179 179 /* Debugging stuff */
180 180 #ifdef CONFIG_IPW2100_DEBUG
include/linux/netdevice.h
... ... @@ -964,7 +964,7 @@
964 964 */
965 965 char name[IFNAMSIZ];
966 966  
967   - struct pm_qos_request_list pm_qos_req;
  967 + struct pm_qos_request pm_qos_req;
968 968  
969 969 /* device name hash chain */
970 970 struct hlist_node name_hlist;
include/linux/pm_qos.h
... ... @@ -20,30 +20,30 @@
20 20 #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
21 21 #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
22 22  
23   -struct pm_qos_request_list {
24   - struct plist_node list;
  23 +struct pm_qos_request {
  24 + struct plist_node node;
25 25 int pm_qos_class;
26 26 };
27 27  
28 28 #ifdef CONFIG_PM
29   -void pm_qos_add_request(struct pm_qos_request_list *l,
30   - int pm_qos_class, s32 value);
31   -void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
  29 +void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
  30 + s32 value);
  31 +void pm_qos_update_request(struct pm_qos_request *req,
32 32 s32 new_value);
33   -void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
  33 +void pm_qos_remove_request(struct pm_qos_request *req);
34 34  
35 35 int pm_qos_request(int pm_qos_class);
36 36 int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
37 37 int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
38   -int pm_qos_request_active(struct pm_qos_request_list *req);
  38 +int pm_qos_request_active(struct pm_qos_request *req);
39 39 #else
40   -static inline void pm_qos_add_request(struct pm_qos_request_list *l,
  40 +static inline void pm_qos_add_request(struct pm_qos_request *req,
41 41 int pm_qos_class, s32 value)
42 42 { return; }
43   -static inline void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
  43 +static inline void pm_qos_update_request(struct pm_qos_request *req,
44 44 s32 new_value)
45 45 { return; }
46   -static inline void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req)
  46 +static inline void pm_qos_remove_request(struct pm_qos_request *req)
47 47 { return; }
48 48  
49 49 static inline int pm_qos_request(int pm_qos_class)
... ... @@ -54,7 +54,7 @@
54 54 static inline int pm_qos_remove_notifier(int pm_qos_class,
55 55 struct notifier_block *notifier)
56 56 { return 0; }
57   -static inline int pm_qos_request_active(struct pm_qos_request_list *req)
  57 +static inline int pm_qos_request_active(struct pm_qos_request *req)
58 58 { return 0; }
59 59 #endif
60 60  
... ... @@ -373,7 +373,7 @@
373 373 int number;
374 374 char name[32]; /* substream name */
375 375 int stream; /* stream (direction) */
376   - struct pm_qos_request_list latency_pm_qos_req; /* pm_qos request */
  376 + struct pm_qos_request latency_pm_qos_req; /* pm_qos request */
377 377 size_t buffer_bytes_max; /* limit ring buffer size */
378 378 struct snd_dma_buffer dma_buffer;
379 379 unsigned int dma_buf_id;
... ... @@ -45,7 +45,7 @@
45 45 #include <linux/uaccess.h>
46 46  
47 47 /*
48   - * locking rule: all changes to requests or notifiers lists
  48 + * locking rule: all changes to constraints or notifiers lists
49 49 * or pm_qos_object list and pm_qos_objects need to happen with pm_qos_lock
50 50 * held, taken with _irqsave. One lock to rule them all
51 51 */
... ... @@ -60,7 +60,7 @@
60 60 * types linux supports for 32 bit quantites
61 61 */
62 62 struct pm_qos_object {
63   - struct plist_head requests;
  63 + struct plist_head constraints;
64 64 struct blocking_notifier_head *notifiers;
65 65 struct miscdevice pm_qos_power_miscdev;
66 66 char *name;
... ... @@ -74,7 +74,7 @@
74 74 static struct pm_qos_object null_pm_qos;
75 75 static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier);
76 76 static 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),
78 78 .notifiers = &cpu_dma_lat_notifier,
79 79 .name = "cpu_dma_latency",
80 80 .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE,
... ... @@ -84,7 +84,7 @@
84 84  
85 85 static BLOCKING_NOTIFIER_HEAD(network_lat_notifier);
86 86 static 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),
88 88 .notifiers = &network_lat_notifier,
89 89 .name = "network_latency",
90 90 .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE,
... ... @@ -95,7 +95,7 @@
95 95  
96 96 static BLOCKING_NOTIFIER_HEAD(network_throughput_notifier);
97 97 static 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),
99 99 .notifiers = &network_throughput_notifier,
100 100 .name = "network_throughput",
101 101 .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE,
102 102  
103 103  
... ... @@ -129,15 +129,15 @@
129 129 /* unlocked internal variant */
130 130 static inline int pm_qos_get_value(struct pm_qos_object *o)
131 131 {
132   - if (plist_head_empty(&o->requests))
  132 + if (plist_head_empty(&o->constraints))
133 133 return o->default_value;
134 134  
135 135 switch (o->type) {
136 136 case PM_QOS_MIN:
137   - return plist_first(&o->requests)->prio;
  137 + return plist_first(&o->constraints)->prio;
138 138  
139 139 case PM_QOS_MAX:
140   - return plist_last(&o->requests)->prio;
  140 + return plist_last(&o->constraints)->prio;
141 141  
142 142 default:
143 143 /* runtime check for not using enum */
144 144  
145 145  
146 146  
... ... @@ -170,13 +170,13 @@
170 170 * with new value and add, then see if the extremal
171 171 * changed
172 172 */
173   - plist_del(node, &o->requests);
  173 + plist_del(node, &o->constraints);
174 174 plist_node_init(node, value);
175   - plist_add(node, &o->requests);
  175 + plist_add(node, &o->constraints);
176 176 } else if (del) {
177   - plist_del(node, &o->requests);
  177 + plist_del(node, &o->constraints);
178 178 } else {
179   - plist_add(node, &o->requests);
  179 + plist_add(node, &o->constraints);
180 180 }
181 181 curr_value = pm_qos_get_value(o);
182 182 pm_qos_set_value(o, curr_value);
... ... @@ -222,7 +222,7 @@
222 222 }
223 223 EXPORT_SYMBOL_GPL(pm_qos_request);
224 224  
225   -int pm_qos_request_active(struct pm_qos_request_list *req)
  225 +int pm_qos_request_active(struct pm_qos_request *req)
226 226 {
227 227 return req->pm_qos_class != 0;
228 228 }
229 229  
230 230  
231 231  
... ... @@ -230,24 +230,24 @@
230 230  
231 231 /**
232 232 * 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
234 234 * @pm_qos_class: identifies which list of qos request to use
235 235 * @value: defines the qos request
236 236 *
237 237 * This function inserts a new entry in the pm_qos_class list of requested qos
238 238 * 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
240 240 * handle. Caller needs to save this handle for later use in updates and
241 241 * removal.
242 242 */
243 243  
244   -void pm_qos_add_request(struct pm_qos_request_list *dep,
  244 +void pm_qos_add_request(struct pm_qos_request *req,
245 245 int pm_qos_class, s32 value)
246 246 {
247 247 struct pm_qos_object *o = pm_qos_array[pm_qos_class];
248 248 int new_value;
249 249  
250   - if (pm_qos_request_active(dep)) {
  250 + if (pm_qos_request_active(req)) {
251 251 WARN(1, KERN_ERR "pm_qos_add_request() called for already added request\n");
252 252 return;
253 253 }
254 254  
... ... @@ -255,15 +255,15 @@
255 255 new_value = o->default_value;
256 256 else
257 257 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);
261 261 }
262 262 EXPORT_SYMBOL_GPL(pm_qos_add_request);
263 263  
264 264 /**
265 265 * 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
267 267 * @value: defines the qos request
268 268 *
269 269 * Updates an existing qos request for the pm_qos_class of parameters along
270 270  
271 271  
272 272  
273 273  
274 274  
275 275  
276 276  
277 277  
278 278  
279 279  
... ... @@ -271,56 +271,56 @@
271 271 *
272 272 * Attempts are made to make this code callable on hot code paths.
273 273 */
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,
275 275 s32 new_value)
276 276 {
277 277 s32 temp;
278 278 struct pm_qos_object *o;
279 279  
280   - if (!pm_qos_req) /*guard against callers passing in null */
  280 + if (!req) /*guard against callers passing in null */
281 281 return;
282 282  
283   - if (!pm_qos_request_active(pm_qos_req)) {
  283 + if (!pm_qos_request_active(req)) {
284 284 WARN(1, KERN_ERR "pm_qos_update_request() called for unknown object\n");
285 285 return;
286 286 }
287 287  
288   - o = pm_qos_array[pm_qos_req->pm_qos_class];
  288 + o = pm_qos_array[req->pm_qos_class];
289 289  
290 290 if (new_value == PM_QOS_DEFAULT_VALUE)
291 291 temp = o->default_value;
292 292 else
293 293 temp = new_value;
294 294  
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);
297 297 }
298 298 EXPORT_SYMBOL_GPL(pm_qos_update_request);
299 299  
300 300 /**
301 301 * 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
303 303 *
304   - * Will remove pm qos request from the list of requests and
  304 + * Will remove pm qos request from the list of constraints and
305 305 * recompute the current target value for the pm_qos_class. Call this
306 306 * on slow code paths.
307 307 */
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)
309 309 {
310 310 struct pm_qos_object *o;
311 311  
312   - if (pm_qos_req == NULL)
  312 + if (req == NULL)
313 313 return;
314 314 /* silent return to keep pcm code cleaner */
315 315  
316   - if (!pm_qos_request_active(pm_qos_req)) {
  316 + if (!pm_qos_request_active(req)) {
317 317 WARN(1, KERN_ERR "pm_qos_remove_request() called for unknown object\n");
318 318 return;
319 319 }
320 320  
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));
324 324 }
325 325 EXPORT_SYMBOL_GPL(pm_qos_remove_request);
326 326  
... ... @@ -368,7 +368,7 @@
368 368  
369 369 pm_qos_class = find_pm_qos_object_by_minor(iminor(inode));
370 370 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);
372 372 if (!req)
373 373 return -ENOMEM;
374 374  
... ... @@ -383,7 +383,7 @@
383 383  
384 384 static int pm_qos_power_release(struct inode *inode, struct file *filp)
385 385 {
386   - struct pm_qos_request_list *req;
  386 + struct pm_qos_request *req;
387 387  
388 388 req = filp->private_data;
389 389 pm_qos_remove_request(req);
390 390  
391 391  
392 392  
... ... @@ -399,14 +399,14 @@
399 399 s32 value;
400 400 unsigned long flags;
401 401 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;
403 403  
404   - if (!pm_qos_req)
  404 + if (!req)
405 405 return -EINVAL;
406   - if (!pm_qos_request_active(pm_qos_req))
  406 + if (!pm_qos_request_active(req))
407 407 return -EINVAL;
408 408  
409   - o = pm_qos_array[pm_qos_req->pm_qos_class];
  409 + o = pm_qos_array[req->pm_qos_class];
410 410 spin_lock_irqsave(&pm_qos_lock, flags);
411 411 value = pm_qos_get_value(o);
412 412 spin_unlock_irqrestore(&pm_qos_lock, flags);
... ... @@ -418,7 +418,7 @@
418 418 size_t count, loff_t *f_pos)
419 419 {
420 420 s32 value;
421   - struct pm_qos_request_list *pm_qos_req;
  421 + struct pm_qos_request *req;
422 422  
423 423 if (count == sizeof(s32)) {
424 424 if (copy_from_user(&value, buf, sizeof(s32)))
... ... @@ -449,8 +449,8 @@
449 449 return -EINVAL;
450 450 }
451 451  
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);
454 454  
455 455 return count;
456 456 }