Commit a1ce5ba2b7d08ab6347dc254f86f70e91c5f1a44
1 parent
2cd005cac6
Exists in
master
and in
4 other branches
cpupowerutils: utils - ConfigStyle bugfixes
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Showing 6 changed files with 122 additions and 108 deletions Side-by-side Diff
tools/power/cpupower/utils/cpufreq-info.c
... | ... | @@ -27,7 +27,7 @@ |
27 | 27 | unsigned int cpunr = 0; |
28 | 28 | |
29 | 29 | fp = fopen("/proc/stat", "r"); |
30 | - if(!fp) { | |
30 | + if (!fp) { | |
31 | 31 | printf(_("Couldn't count the number of CPUs (%s: %s), assuming 1\n"), "/proc/stat", strerror(errno)); |
32 | 32 | return 1; |
33 | 33 | } |
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | fclose(fp); |
49 | 49 | |
50 | 50 | /* cpu count starts from 0, on error return 1 (UP) */ |
51 | - return (ret+1); | |
51 | + return ret + 1; | |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | printf(_(" minimum CPU frequency - maximum CPU frequency - governor\n")); |
64 | 64 | |
65 | 65 | nr_cpus = count_cpus(); |
66 | - for (cpu=0; cpu < nr_cpus; cpu++) { | |
66 | + for (cpu = 0; cpu < nr_cpus; cpu++) { | |
67 | 67 | policy = cpufreq_get_policy(cpu); |
68 | 68 | if (!policy) |
69 | 69 | continue; |
... | ... | @@ -75,7 +75,8 @@ |
75 | 75 | max_pctg = (policy->max * 100) / max; |
76 | 76 | } |
77 | 77 | printf("CPU%3d %9lu kHz (%3d %%) - %9lu kHz (%3d %%) - %s\n", |
78 | - cpu , policy->min, max ? min_pctg : 0, policy->max, max ? max_pctg : 0, policy->governor); | |
78 | + cpu , policy->min, max ? min_pctg : 0, policy->max, | |
79 | + max ? max_pctg : 0, policy->governor); | |
79 | 80 | |
80 | 81 | cpufreq_put_policy(policy); |
81 | 82 | } |
82 | 83 | |
83 | 84 | |
84 | 85 | |
... | ... | @@ -89,21 +90,21 @@ |
89 | 90 | tmp = speed % 10000; |
90 | 91 | if (tmp >= 5000) |
91 | 92 | speed += 10000; |
92 | - printf ("%u.%02u GHz", ((unsigned int) speed/1000000), | |
93 | + printf("%u.%02u GHz", ((unsigned int) speed/1000000), | |
93 | 94 | ((unsigned int) (speed%1000000)/10000)); |
94 | 95 | } else if (speed > 100000) { |
95 | 96 | tmp = speed % 1000; |
96 | 97 | if (tmp >= 500) |
97 | 98 | speed += 1000; |
98 | - printf ("%u MHz", ((unsigned int) speed / 1000)); | |
99 | + printf("%u MHz", ((unsigned int) speed / 1000)); | |
99 | 100 | } else if (speed > 1000) { |
100 | 101 | tmp = speed % 100; |
101 | 102 | if (tmp >= 50) |
102 | 103 | speed += 100; |
103 | - printf ("%u.%01u MHz", ((unsigned int) speed/1000), | |
104 | + printf("%u.%01u MHz", ((unsigned int) speed/1000), | |
104 | 105 | ((unsigned int) (speed%1000)/100)); |
105 | 106 | } else |
106 | - printf ("%lu kHz", speed); | |
107 | + printf("%lu kHz", speed); | |
107 | 108 | |
108 | 109 | return; |
109 | 110 | } |
110 | 111 | |
111 | 112 | |
112 | 113 | |
113 | 114 | |
... | ... | @@ -116,28 +117,29 @@ |
116 | 117 | tmp = duration % 10000; |
117 | 118 | if (tmp >= 5000) |
118 | 119 | duration += 10000; |
119 | - printf ("%u.%02u ms", ((unsigned int) duration/1000000), | |
120 | + printf("%u.%02u ms", ((unsigned int) duration/1000000), | |
120 | 121 | ((unsigned int) (duration%1000000)/10000)); |
121 | 122 | } else if (duration > 100000) { |
122 | 123 | tmp = duration % 1000; |
123 | 124 | if (tmp >= 500) |
124 | 125 | duration += 1000; |
125 | - printf ("%u us", ((unsigned int) duration / 1000)); | |
126 | + printf("%u us", ((unsigned int) duration / 1000)); | |
126 | 127 | } else if (duration > 1000) { |
127 | 128 | tmp = duration % 100; |
128 | 129 | if (tmp >= 50) |
129 | 130 | duration += 100; |
130 | - printf ("%u.%01u us", ((unsigned int) duration/1000), | |
131 | + printf("%u.%01u us", ((unsigned int) duration/1000), | |
131 | 132 | ((unsigned int) (duration%1000)/100)); |
132 | 133 | } else |
133 | - printf ("%lu ns", duration); | |
134 | + printf("%lu ns", duration); | |
134 | 135 | |
135 | 136 | return; |
136 | 137 | } |
137 | 138 | |
138 | 139 | /* --boost / -b */ |
139 | 140 | |
140 | -static int get_boost_mode(unsigned int cpu) { | |
141 | +static int get_boost_mode(unsigned int cpu) | |
142 | +{ | |
141 | 143 | int support, active, b_states = 0, ret, pstate_no, i; |
142 | 144 | /* ToDo: Make this more global */ |
143 | 145 | unsigned long pstates[MAX_HW_PSTATES] = {0,}; |
144 | 146 | |
... | ... | @@ -158,13 +160,13 @@ |
158 | 160 | && (cpuid_edx(0x80000007) & (1 << 7))) |
159 | 161 | */ |
160 | 162 | |
161 | - printf(_(" boost state support: \n")); | |
163 | + printf(_(" boost state support:\n")); | |
162 | 164 | |
163 | 165 | printf(_(" Supported: %s\n"), support ? _("yes") : _("no")); |
164 | 166 | printf(_(" Active: %s\n"), active ? _("yes") : _("no")); |
165 | 167 | |
166 | 168 | /* ToDo: Only works for AMD for now... */ |
167 | - | |
169 | + | |
168 | 170 | if (cpupower_cpu_info.vendor == X86_VENDOR_AMD && |
169 | 171 | cpupower_cpu_info.family >= 0x10) { |
170 | 172 | ret = decode_pstates(cpu, cpupower_cpu_info.family, b_states, |
171 | 173 | |
172 | 174 | |
... | ... | @@ -196,12 +198,11 @@ |
196 | 198 | unsigned long total_trans, latency; |
197 | 199 | unsigned long long total_time; |
198 | 200 | struct cpufreq_policy *policy; |
199 | - struct cpufreq_available_governors * governors; | |
201 | + struct cpufreq_available_governors *governors; | |
200 | 202 | struct cpufreq_stats *stats; |
201 | 203 | |
202 | - if (cpufreq_cpu_exists(cpu)) { | |
204 | + if (cpufreq_cpu_exists(cpu)) | |
203 | 205 | return; |
204 | - } | |
205 | 206 | |
206 | 207 | freq_kernel = cpufreq_get_freq_kernel(cpu); |
207 | 208 | freq_hardware = cpufreq_get_freq_hardware(cpu); |
... | ... | @@ -294,8 +295,7 @@ |
294 | 295 | if (freq_hardware) { |
295 | 296 | print_speed(freq_hardware); |
296 | 297 | printf(_(" (asserted by call to hardware)")); |
297 | - } | |
298 | - else | |
298 | + } else | |
299 | 299 | print_speed(freq_kernel); |
300 | 300 | printf(".\n"); |
301 | 301 | } |
... | ... | @@ -322,7 +322,8 @@ |
322 | 322 | |
323 | 323 | /* --freq / -f */ |
324 | 324 | |
325 | -static int get_freq_kernel(unsigned int cpu, unsigned int human) { | |
325 | +static int get_freq_kernel(unsigned int cpu, unsigned int human) | |
326 | +{ | |
326 | 327 | unsigned long freq = cpufreq_get_freq_kernel(cpu); |
327 | 328 | if (!freq) |
328 | 329 | return -EINVAL; |
... | ... | @@ -337,7 +338,8 @@ |
337 | 338 | |
338 | 339 | /* --hwfreq / -w */ |
339 | 340 | |
340 | -static int get_freq_hardware(unsigned int cpu, unsigned int human) { | |
341 | +static int get_freq_hardware(unsigned int cpu, unsigned int human) | |
342 | +{ | |
341 | 343 | unsigned long freq = cpufreq_get_freq_hardware(cpu); |
342 | 344 | if (!freq) |
343 | 345 | return -EINVAL; |
... | ... | @@ -351,7 +353,8 @@ |
351 | 353 | |
352 | 354 | /* --hwlimits / -l */ |
353 | 355 | |
354 | -static int get_hardware_limits(unsigned int cpu) { | |
356 | +static int get_hardware_limits(unsigned int cpu) | |
357 | +{ | |
355 | 358 | unsigned long min, max; |
356 | 359 | if (cpufreq_get_hardware_limits(cpu, &min, &max)) |
357 | 360 | return -EINVAL; |
... | ... | @@ -361,7 +364,8 @@ |
361 | 364 | |
362 | 365 | /* --driver / -d */ |
363 | 366 | |
364 | -static int get_driver(unsigned int cpu) { | |
367 | +static int get_driver(unsigned int cpu) | |
368 | +{ | |
365 | 369 | char *driver = cpufreq_get_driver(cpu); |
366 | 370 | if (!driver) |
367 | 371 | return -EINVAL; |
... | ... | @@ -372,7 +376,8 @@ |
372 | 376 | |
373 | 377 | /* --policy / -p */ |
374 | 378 | |
375 | -static int get_policy(unsigned int cpu) { | |
379 | +static int get_policy(unsigned int cpu) | |
380 | +{ | |
376 | 381 | struct cpufreq_policy *policy = cpufreq_get_policy(cpu); |
377 | 382 | if (!policy) |
378 | 383 | return -EINVAL; |
... | ... | @@ -383,8 +388,10 @@ |
383 | 388 | |
384 | 389 | /* --governors / -g */ |
385 | 390 | |
386 | -static int get_available_governors(unsigned int cpu) { | |
387 | - struct cpufreq_available_governors *governors = cpufreq_get_available_governors(cpu); | |
391 | +static int get_available_governors(unsigned int cpu) | |
392 | +{ | |
393 | + struct cpufreq_available_governors *governors = | |
394 | + cpufreq_get_available_governors(cpu); | |
388 | 395 | if (!governors) |
389 | 396 | return -EINVAL; |
390 | 397 | |
... | ... | @@ -400,7 +407,8 @@ |
400 | 407 | |
401 | 408 | /* --affected-cpus / -a */ |
402 | 409 | |
403 | -static int get_affected_cpus(unsigned int cpu) { | |
410 | +static int get_affected_cpus(unsigned int cpu) | |
411 | +{ | |
404 | 412 | struct cpufreq_affected_cpus *cpus = cpufreq_get_affected_cpus(cpu); |
405 | 413 | if (!cpus) |
406 | 414 | return -EINVAL; |
... | ... | @@ -416,7 +424,8 @@ |
416 | 424 | |
417 | 425 | /* --related-cpus / -r */ |
418 | 426 | |
419 | -static int get_related_cpus(unsigned int cpu) { | |
427 | +static int get_related_cpus(unsigned int cpu) | |
428 | +{ | |
420 | 429 | struct cpufreq_affected_cpus *cpus = cpufreq_get_related_cpus(cpu); |
421 | 430 | if (!cpus) |
422 | 431 | return -EINVAL; |
423 | 432 | |
... | ... | @@ -432,17 +441,19 @@ |
432 | 441 | |
433 | 442 | /* --stats / -s */ |
434 | 443 | |
435 | -static int get_freq_stats(unsigned int cpu, unsigned int human) { | |
444 | +static int get_freq_stats(unsigned int cpu, unsigned int human) | |
445 | +{ | |
436 | 446 | unsigned long total_trans = cpufreq_get_transitions(cpu); |
437 | 447 | unsigned long long total_time; |
438 | 448 | struct cpufreq_stats *stats = cpufreq_get_stats(cpu, &total_time); |
439 | 449 | while (stats) { |
440 | 450 | if (human) { |
441 | 451 | print_speed(stats->frequency); |
442 | - printf(":%.2f%%", (100.0 * stats->time_in_state) / total_time); | |
443 | - } | |
444 | - else | |
445 | - printf("%lu:%llu", stats->frequency, stats->time_in_state); | |
452 | + printf(":%.2f%%", | |
453 | + (100.0 * stats->time_in_state) / total_time); | |
454 | + } else | |
455 | + printf("%lu:%llu", | |
456 | + stats->frequency, stats->time_in_state); | |
446 | 457 | stats = stats->next; |
447 | 458 | if (stats) |
448 | 459 | printf(", "); |
... | ... | @@ -455,7 +466,8 @@ |
455 | 466 | |
456 | 467 | /* --latency / -y */ |
457 | 468 | |
458 | -static int get_latency(unsigned int cpu, unsigned int human) { | |
469 | +static int get_latency(unsigned int cpu, unsigned int human) | |
470 | +{ | |
459 | 471 | unsigned long latency = cpufreq_get_transition_latency(cpu); |
460 | 472 | if (!latency) |
461 | 473 | return -EINVAL; |
... | ... | @@ -468,7 +480,8 @@ |
468 | 480 | return 0; |
469 | 481 | } |
470 | 482 | |
471 | -void freq_info_help(void) { | |
483 | +void freq_info_help(void) | |
484 | +{ | |
472 | 485 | printf(_("Usage: cpupower freqinfo [options]\n")); |
473 | 486 | printf(_("Options:\n")); |
474 | 487 | printf(_(" -e, --debug Prints out debug information [default]\n")); |
475 | 488 | |
... | ... | @@ -494,26 +507,26 @@ |
494 | 507 | printf("\n"); |
495 | 508 | printf(_("If no argument is given, full output about\n" |
496 | 509 | "cpufreq is printed which is useful e.g. for reporting bugs.\n\n")); |
497 | - printf(_("By default info of CPU 0 is shown which can be overridden \n" | |
510 | + printf(_("By default info of CPU 0 is shown which can be overridden\n" | |
498 | 511 | "with the cpupower --cpu main command option.\n")); |
499 | 512 | } |
500 | 513 | |
501 | 514 | static struct option info_opts[] = { |
502 | - { .name="debug", .has_arg=no_argument, .flag=NULL, .val='e'}, | |
503 | - { .name="boost", .has_arg=no_argument, .flag=NULL, .val='b'}, | |
504 | - { .name="freq", .has_arg=no_argument, .flag=NULL, .val='f'}, | |
505 | - { .name="hwfreq", .has_arg=no_argument, .flag=NULL, .val='w'}, | |
506 | - { .name="hwlimits", .has_arg=no_argument, .flag=NULL, .val='l'}, | |
507 | - { .name="driver", .has_arg=no_argument, .flag=NULL, .val='d'}, | |
508 | - { .name="policy", .has_arg=no_argument, .flag=NULL, .val='p'}, | |
509 | - { .name="governors", .has_arg=no_argument, .flag=NULL, .val='g'}, | |
510 | - { .name="related-cpus", .has_arg=no_argument, .flag=NULL, .val='r'}, | |
511 | - { .name="affected-cpus",.has_arg=no_argument, .flag=NULL, .val='a'}, | |
512 | - { .name="stats", .has_arg=no_argument, .flag=NULL, .val='s'}, | |
513 | - { .name="latency", .has_arg=no_argument, .flag=NULL, .val='y'}, | |
514 | - { .name="proc", .has_arg=no_argument, .flag=NULL, .val='o'}, | |
515 | - { .name="human", .has_arg=no_argument, .flag=NULL, .val='m'}, | |
516 | - { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | |
515 | + { .name = "debug", .has_arg = no_argument, .flag = NULL, .val = 'e'}, | |
516 | + { .name = "boost", .has_arg = no_argument, .flag = NULL, .val = 'b'}, | |
517 | + { .name = "freq", .has_arg = no_argument, .flag = NULL, .val = 'f'}, | |
518 | + { .name = "hwfreq", .has_arg = no_argument, .flag = NULL, .val = 'w'}, | |
519 | + { .name = "hwlimits", .has_arg = no_argument, .flag = NULL, .val = 'l'}, | |
520 | + { .name = "driver", .has_arg = no_argument, .flag = NULL, .val = 'd'}, | |
521 | + { .name = "policy", .has_arg = no_argument, .flag = NULL, .val = 'p'}, | |
522 | + { .name = "governors", .has_arg = no_argument, .flag = NULL, .val = 'g'}, | |
523 | + { .name = "related-cpus", .has_arg = no_argument, .flag = NULL, .val = 'r'}, | |
524 | + { .name = "affected-cpus",.has_arg = no_argument, .flag = NULL, .val = 'a'}, | |
525 | + { .name = "stats", .has_arg = no_argument, .flag = NULL, .val = 's'}, | |
526 | + { .name = "latency", .has_arg = no_argument, .flag = NULL, .val = 'y'}, | |
527 | + { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, | |
528 | + { .name = "human", .has_arg = no_argument, .flag = NULL, .val = 'm'}, | |
529 | + { .name = "help", .has_arg = no_argument, .flag = NULL, .val = 'h'}, | |
517 | 530 | { }, |
518 | 531 | }; |
519 | 532 | |
... | ... | @@ -572,7 +585,7 @@ |
572 | 585 | fprintf(stderr, "invalid or unknown argument\n"); |
573 | 586 | return EXIT_FAILURE; |
574 | 587 | } |
575 | - } while(cont); | |
588 | + } while (cont); | |
576 | 589 | |
577 | 590 | switch (output_param) { |
578 | 591 | case 'o': |
... | ... | @@ -591,7 +604,7 @@ |
591 | 604 | /* Default is: show output of CPU 0 only */ |
592 | 605 | if (bitmask_isallclear(cpus_chosen)) |
593 | 606 | bitmask_setbit(cpus_chosen, 0); |
594 | - | |
607 | + | |
595 | 608 | switch (output_param) { |
596 | 609 | case -1: |
597 | 610 | printf(_("You can't specify more than one --cpu parameter and/or\n" |
... | ... | @@ -659,7 +672,7 @@ |
659 | 672 | break; |
660 | 673 | } |
661 | 674 | if (ret) |
662 | - return (ret); | |
675 | + return ret; | |
663 | 676 | } |
664 | 677 | return ret; |
665 | 678 | } |
tools/power/cpupower/utils/cpufreq-set.c
... | ... | @@ -43,12 +43,12 @@ |
43 | 43 | } |
44 | 44 | |
45 | 45 | static struct option set_opts[] = { |
46 | - { .name="min", .has_arg=required_argument, .flag=NULL, .val='d'}, | |
47 | - { .name="max", .has_arg=required_argument, .flag=NULL, .val='u'}, | |
48 | - { .name="governor", .has_arg=required_argument, .flag=NULL, .val='g'}, | |
49 | - { .name="freq", .has_arg=required_argument, .flag=NULL, .val='f'}, | |
50 | - { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | |
51 | - { .name="related", .has_arg=no_argument, .flag=NULL, .val='r'}, | |
46 | + { .name = "min", .has_arg = required_argument, .flag = NULL, .val = 'd'}, | |
47 | + { .name = "max", .has_arg = required_argument, .flag = NULL, .val = 'u'}, | |
48 | + { .name = "governor", .has_arg = required_argument, .flag = NULL, .val = 'g'}, | |
49 | + { .name = "freq", .has_arg = required_argument, .flag = NULL, .val = 'f'}, | |
50 | + { .name = "help", .has_arg = no_argument, .flag = NULL, .val = 'h'}, | |
51 | + { .name = "related", .has_arg = no_argument, .flag = NULL, .val='r'}, | |
52 | 52 | { }, |
53 | 53 | }; |
54 | 54 | |
... | ... | @@ -64,7 +64,7 @@ |
64 | 64 | }; |
65 | 65 | |
66 | 66 | struct freq_units { |
67 | - char* str_unit; | |
67 | + char *str_unit; | |
68 | 68 | int power_of_ten; |
69 | 69 | }; |
70 | 70 | |
... | ... | @@ -204,7 +204,8 @@ |
204 | 204 | else if (new_pol->max) |
205 | 205 | return cpufreq_modify_policy_max(cpu, new_pol->max); |
206 | 206 | else if (new_pol->governor) |
207 | - return cpufreq_modify_policy_governor(cpu, new_pol->governor); | |
207 | + return cpufreq_modify_policy_governor(cpu, | |
208 | + new_pol->governor); | |
208 | 209 | |
209 | 210 | default: |
210 | 211 | /* slow path */ |
211 | 212 | |
212 | 213 | |
... | ... | @@ -282,15 +283,15 @@ |
282 | 283 | if ((strlen(optarg) < 3) || (strlen(optarg) > 18)) { |
283 | 284 | print_unknown_arg(); |
284 | 285 | return -EINVAL; |
285 | - } | |
286 | + } | |
286 | 287 | if ((sscanf(optarg, "%s", gov)) != 1) { |
287 | 288 | print_unknown_arg(); |
288 | 289 | return -EINVAL; |
289 | - } | |
290 | + } | |
290 | 291 | new_pol.governor = gov; |
291 | 292 | break; |
292 | 293 | } |
293 | - } while(cont); | |
294 | + } while (cont); | |
294 | 295 | |
295 | 296 | /* parameter checking */ |
296 | 297 | if (double_parm) { |
... | ... | @@ -339,7 +340,7 @@ |
339 | 340 | /* loop over CPUs */ |
340 | 341 | for (cpu = bitmask_first(cpus_chosen); |
341 | 342 | cpu <= bitmask_last(cpus_chosen); cpu++) { |
342 | - | |
343 | + | |
343 | 344 | if (!bitmask_isbitset(cpus_chosen, cpu) || |
344 | 345 | cpufreq_cpu_exists(cpu)) |
345 | 346 | continue; |
tools/power/cpupower/utils/cpuidle-info.c
... | ... | @@ -31,8 +31,7 @@ |
31 | 31 | if (idlestates == 0) { |
32 | 32 | printf(_("CPU %u: No idle states\n"), cpu); |
33 | 33 | return; |
34 | - } | |
35 | - else if (idlestates <= 0) { | |
34 | + } else if (idlestates <= 0) { | |
36 | 35 | printf(_("CPU %u: Can't read idle state info\n"), cpu); |
37 | 36 | return; |
38 | 37 | } |
... | ... | @@ -92,7 +91,7 @@ |
92 | 91 | } |
93 | 92 | |
94 | 93 | printf(_("CPUidle driver: %s\n"), tmp); |
95 | - free (tmp); | |
94 | + free(tmp); | |
96 | 95 | |
97 | 96 | tmp = sysfs_get_cpuidle_governor(); |
98 | 97 | if (!tmp) { |
... | ... | @@ -101,7 +100,7 @@ |
101 | 100 | } |
102 | 101 | |
103 | 102 | printf(_("CPUidle governor: %s\n"), tmp); |
104 | - free (tmp); | |
103 | + free(tmp); | |
105 | 104 | } |
106 | 105 | |
107 | 106 | static void proc_cpuidle_cpu_output(unsigned int cpu) |
... | ... | @@ -117,8 +116,7 @@ |
117 | 116 | * printf(_("CPU %u: No C-states available\n"), cpu); |
118 | 117 | * return; |
119 | 118 | */ |
120 | - } | |
121 | - else if (cstates <= 0) { | |
119 | + } else if (cstates <= 0) { | |
122 | 120 | printf(_("CPU %u: Can't read C-state info\n"), cpu); |
123 | 121 | return; |
124 | 122 | } |
... | ... | @@ -143,7 +141,8 @@ |
143 | 141 | |
144 | 142 | /* --freq / -f */ |
145 | 143 | |
146 | -void idle_info_help(void) { | |
144 | +void idle_info_help(void) | |
145 | +{ | |
147 | 146 | printf(_ ("Usage: cpupower idleinfo [options]\n")); |
148 | 147 | printf(_ ("Options:\n")); |
149 | 148 | printf(_ (" -s, --silent Only show general C-state information\n")); |
... | ... | @@ -155,9 +154,9 @@ |
155 | 154 | } |
156 | 155 | |
157 | 156 | static struct option info_opts[] = { |
158 | - { .name="silent", .has_arg=no_argument, .flag=NULL, .val='s'}, | |
159 | - { .name="proc", .has_arg=no_argument, .flag=NULL, .val='o'}, | |
160 | - { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | |
157 | + { .name = "silent", .has_arg = no_argument, .flag = NULL, .val = 's'}, | |
158 | + { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, | |
159 | + { .name = "help", .has_arg = no_argument, .flag = NULL, .val = 'h'}, | |
161 | 160 | { }, |
162 | 161 | }; |
163 | 162 | |
... | ... | @@ -202,7 +201,7 @@ |
202 | 201 | output_param = ret; |
203 | 202 | break; |
204 | 203 | } |
205 | - } while(cont); | |
204 | + } while (cont); | |
206 | 205 | |
207 | 206 | switch (output_param) { |
208 | 207 | case -1: |
209 | 208 | |
... | ... | @@ -219,10 +218,10 @@ |
219 | 218 | /* Default is: show output of CPU 0 only */ |
220 | 219 | if (bitmask_isallclear(cpus_chosen)) |
221 | 220 | bitmask_setbit(cpus_chosen, 0); |
222 | - | |
221 | + | |
223 | 222 | if (output_param == 0) |
224 | 223 | cpuidle_general_output(); |
225 | - | |
224 | + | |
226 | 225 | for (cpu = bitmask_first(cpus_chosen); |
227 | 226 | cpu <= bitmask_last(cpus_chosen); cpu++) { |
228 | 227 | |
... | ... | @@ -241,6 +240,6 @@ |
241 | 240 | break; |
242 | 241 | } |
243 | 242 | } |
244 | - return (EXIT_SUCCESS); | |
243 | + return EXIT_SUCCESS; | |
245 | 244 | } |
tools/power/cpupower/utils/cpupower-info.c
... | ... | @@ -30,10 +30,10 @@ |
30 | 30 | } |
31 | 31 | |
32 | 32 | static struct option set_opts[] = { |
33 | - { .name="perf-bias", .has_arg=optional_argument, .flag=NULL, .val='b'}, | |
34 | - { .name="sched-mc", .has_arg=optional_argument, .flag=NULL, .val='m'}, | |
35 | - { .name="sched-smt", .has_arg=optional_argument, .flag=NULL, .val='s'}, | |
36 | - { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | |
33 | + { .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'}, | |
34 | + { .name = "sched-mc", .has_arg = optional_argument, .flag = NULL, .val = 'm'}, | |
35 | + { .name = "sched-smt", .has_arg = optional_argument, .flag = NULL, .val = 's'}, | |
36 | + { .name = "help", .has_arg = no_argument, .flag = NULL, .val = 'h'}, | |
37 | 37 | { }, |
38 | 38 | }; |
39 | 39 | |
40 | 40 | |
... | ... | @@ -57,12 +57,11 @@ |
57 | 57 | int perf_bias:1; |
58 | 58 | }; |
59 | 59 | int params; |
60 | - | |
61 | 60 | } params = {}; |
62 | 61 | int ret = 0; |
63 | 62 | |
64 | 63 | setlocale(LC_ALL, ""); |
65 | - textdomain (PACKAGE); | |
64 | + textdomain(PACKAGE); | |
66 | 65 | |
67 | 66 | /* parameter parsing */ |
68 | 67 | while ((ret = getopt_long(argc, argv, "msbh", set_opts, NULL)) != -1) { |
... | ... | @@ -105,7 +104,7 @@ |
105 | 104 | printf(_("not supported\n")); |
106 | 105 | else |
107 | 106 | printf("%d\n", ret); |
108 | - } | |
107 | + } | |
109 | 108 | if (params.sched_smt) { |
110 | 109 | ret = sysfs_get_sched("smt"); |
111 | 110 | printf(_("System's thread sibling scheduler setting: ")); |
... | ... | @@ -123,7 +122,7 @@ |
123 | 122 | if (params.perf_bias) { |
124 | 123 | if (!run_as_root) { |
125 | 124 | params.perf_bias = 0; |
126 | - printf (_("Intel's performance bias setting needs root privileges\n")); | |
125 | + printf(_("Intel's performance bias setting needs root privileges\n")); | |
127 | 126 | } else if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_PERF_BIAS)) { |
128 | 127 | printf(_("System does not support Intel's performance" |
129 | 128 | " bias setting\n")); |
... | ... | @@ -134,7 +133,7 @@ |
134 | 133 | /* loop over CPUs */ |
135 | 134 | for (cpu = bitmask_first(cpus_chosen); |
136 | 135 | cpu <= bitmask_last(cpus_chosen); cpu++) { |
137 | - | |
136 | + | |
138 | 137 | if (!bitmask_isbitset(cpus_chosen, cpu) || |
139 | 138 | cpufreq_cpu_exists(cpu)) |
140 | 139 | continue; |
tools/power/cpupower/utils/cpupower-set.c
... | ... | @@ -30,10 +30,10 @@ |
30 | 30 | } |
31 | 31 | |
32 | 32 | static struct option set_opts[] = { |
33 | - { .name="perf-bias", .has_arg=optional_argument, .flag=NULL, .val='b'}, | |
34 | - { .name="sched-mc", .has_arg=optional_argument, .flag=NULL, .val='m'}, | |
35 | - { .name="sched-smt", .has_arg=optional_argument, .flag=NULL, .val='s'}, | |
36 | - { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | |
33 | + { .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'}, | |
34 | + { .name = "sched-mc", .has_arg = optional_argument, .flag = NULL, .val = 'm'}, | |
35 | + { .name = "sched-smt", .has_arg = optional_argument, .flag = NULL, .val = 's'}, | |
36 | + { .name = "help", .has_arg = no_argument, .flag = NULL, .val = 'h'}, | |
37 | 37 | { }, |
38 | 38 | }; |
39 | 39 | |
40 | 40 | |
41 | 41 | |
... | ... | @@ -57,17 +57,17 @@ |
57 | 57 | int perf_bias:1; |
58 | 58 | }; |
59 | 59 | int params; |
60 | - | |
61 | 60 | } params; |
62 | 61 | int sched_mc = 0, sched_smt = 0, perf_bias = 0; |
63 | 62 | int ret = 0; |
64 | 63 | |
65 | 64 | setlocale(LC_ALL, ""); |
66 | - textdomain (PACKAGE); | |
65 | + textdomain(PACKAGE); | |
67 | 66 | |
68 | 67 | params.params = 0; |
69 | 68 | /* parameter parsing */ |
70 | - while ((ret = getopt_long(argc, argv, "m:s:b:h", set_opts, NULL)) != -1) { | |
69 | + while ((ret = getopt_long(argc, argv, "m:s:b:h", | |
70 | + set_opts, NULL)) != -1) { | |
71 | 71 | switch (ret) { |
72 | 72 | case 'h': |
73 | 73 | set_help(); |
... | ... | @@ -135,7 +135,7 @@ |
135 | 135 | /* loop over CPUs */ |
136 | 136 | for (cpu = bitmask_first(cpus_chosen); |
137 | 137 | cpu <= bitmask_last(cpus_chosen); cpu++) { |
138 | - | |
138 | + | |
139 | 139 | if (!bitmask_isbitset(cpus_chosen, cpu) || |
140 | 140 | cpufreq_cpu_exists(cpu)) |
141 | 141 | continue; |
tools/power/cpupower/utils/cpupower.c
... | ... | @@ -50,8 +50,8 @@ |
50 | 50 | { "set", cmd_set, set_help, 1 }, |
51 | 51 | { "info", cmd_info, info_help, 0 }, |
52 | 52 | { "monitor", cmd_monitor, monitor_help, 0 }, |
53 | - { "help", cmd_help, print_help, 0 }, | |
54 | - // { "bench", cmd_bench, NULL, 1 }, | |
53 | + { "help", cmd_help, print_help, 0 }, | |
54 | + /* { "bench", cmd_bench, NULL, 1 }, */ | |
55 | 55 | }; |
56 | 56 | |
57 | 57 | int cmd_help(int argc, const char **argv) |
... | ... | @@ -95,8 +95,9 @@ |
95 | 95 | printf(_("\nUse cpupower help subcommand for getting help for above subcommands.\n")); |
96 | 96 | } |
97 | 97 | |
98 | -static void print_version(void) { | |
99 | - printf(PACKAGE " " VERSION "\n"); | |
98 | +static void print_version(void) | |
99 | +{ | |
100 | + printf(PACKAGE " " VERSION "\n"); | |
100 | 101 | printf(_("Report errors and bugs to %s, please.\n"), PACKAGE_BUGREPORT); |
101 | 102 | } |
102 | 103 | |
103 | 104 | |
... | ... | @@ -109,10 +110,10 @@ |
109 | 110 | |
110 | 111 | for (x = 0; x < *argc && ((*argv)[x])[0] == '-'; x++) { |
111 | 112 | const char *param = (*argv)[x]; |
112 | - if (!strcmp(param, "-h") || !strcmp(param, "--help")){ | |
113 | + if (!strcmp(param, "-h") || !strcmp(param, "--help")) { | |
113 | 114 | print_help(); |
114 | 115 | exit(EXIT_SUCCESS); |
115 | - } else if (!strcmp(param, "-c") || !strcmp(param, "--cpu")){ | |
116 | + } else if (!strcmp(param, "-c") || !strcmp(param, "--cpu")) { | |
116 | 117 | if (*argc < 2) { |
117 | 118 | print_help(); |
118 | 119 | exit(EXIT_FAILURE); |
119 | 120 | |
120 | 121 | |
... | ... | @@ -132,13 +133,14 @@ |
132 | 133 | /* Cut out param: cpupower -c 1 info -> cpupower info */ |
133 | 134 | new_argc += 2; |
134 | 135 | continue; |
135 | - } else if (!strcmp(param, "-v") || !strcmp(param, "--version")){ | |
136 | + } else if (!strcmp(param, "-v") || | |
137 | + !strcmp(param, "--version")) { | |
136 | 138 | print_version(); |
137 | 139 | exit(EXIT_SUCCESS); |
138 | 140 | #ifdef DEBUG |
139 | - } else if (!strcmp(param, "-d") || !strcmp(param, "--debug")){ | |
141 | + } else if (!strcmp(param, "-d") || !strcmp(param, "--debug")) { | |
140 | 142 | be_verbose = 1; |
141 | - new_argc ++; | |
143 | + new_argc++; | |
142 | 144 | continue; |
143 | 145 | #endif |
144 | 146 | } else { |
... | ... | @@ -171,7 +173,7 @@ |
171 | 173 | } |
172 | 174 | |
173 | 175 | setlocale(LC_ALL, ""); |
174 | - textdomain (PACKAGE); | |
176 | + textdomain(PACKAGE); | |
175 | 177 | |
176 | 178 | /* Turn "perf cmd --help" into "perf help cmd" */ |
177 | 179 | if (argc > 1 && !strcmp(argv[1], "--help")) { |