aboutsummaryrefslogtreecommitdiffstats
path: root/tools/power/cpupower/utils/cpuidle-info.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2011-04-19 14:33:50 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2011-07-29 12:35:39 -0400
commita1ce5ba2b7d08ab6347dc254f86f70e91c5f1a44 (patch)
tree22d59faf4df1547bb9547935c7f63c3ef6a6b387 /tools/power/cpupower/utils/cpuidle-info.c
parent2cd005cac6d586b8ca324814a9c58ed0c08ffe40 (diff)
cpupowerutils: utils - ConfigStyle bugfixes
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'tools/power/cpupower/utils/cpuidle-info.c')
-rw-r--r--tools/power/cpupower/utils/cpuidle-info.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c
index 635468224e74..70da3574f1e9 100644
--- a/tools/power/cpupower/utils/cpuidle-info.c
+++ b/tools/power/cpupower/utils/cpuidle-info.c
@@ -31,8 +31,7 @@ static void cpuidle_cpu_output(unsigned int cpu, int verbose)
31 if (idlestates == 0) { 31 if (idlestates == 0) {
32 printf(_("CPU %u: No idle states\n"), cpu); 32 printf(_("CPU %u: No idle states\n"), cpu);
33 return; 33 return;
34 } 34 } else if (idlestates <= 0) {
35 else if (idlestates <= 0) {
36 printf(_("CPU %u: Can't read idle state info\n"), cpu); 35 printf(_("CPU %u: Can't read idle state info\n"), cpu);
37 return; 36 return;
38 } 37 }
@@ -92,7 +91,7 @@ static void cpuidle_general_output(void)
92 } 91 }
93 92
94 printf(_("CPUidle driver: %s\n"), tmp); 93 printf(_("CPUidle driver: %s\n"), tmp);
95 free (tmp); 94 free(tmp);
96 95
97 tmp = sysfs_get_cpuidle_governor(); 96 tmp = sysfs_get_cpuidle_governor();
98 if (!tmp) { 97 if (!tmp) {
@@ -101,7 +100,7 @@ static void cpuidle_general_output(void)
101 } 100 }
102 101
103 printf(_("CPUidle governor: %s\n"), tmp); 102 printf(_("CPUidle governor: %s\n"), tmp);
104 free (tmp); 103 free(tmp);
105} 104}
106 105
107static void proc_cpuidle_cpu_output(unsigned int cpu) 106static void proc_cpuidle_cpu_output(unsigned int cpu)
@@ -117,8 +116,7 @@ static void proc_cpuidle_cpu_output(unsigned int cpu)
117 * printf(_("CPU %u: No C-states available\n"), cpu); 116 * printf(_("CPU %u: No C-states available\n"), cpu);
118 * return; 117 * return;
119 */ 118 */
120 } 119 } else if (cstates <= 0) {
121 else if (cstates <= 0) {
122 printf(_("CPU %u: Can't read C-state info\n"), cpu); 120 printf(_("CPU %u: Can't read C-state info\n"), cpu);
123 return; 121 return;
124 } 122 }
@@ -143,7 +141,8 @@ static void proc_cpuidle_cpu_output(unsigned int cpu)
143 141
144/* --freq / -f */ 142/* --freq / -f */
145 143
146void idle_info_help(void) { 144void idle_info_help(void)
145{
147 printf(_ ("Usage: cpupower idleinfo [options]\n")); 146 printf(_ ("Usage: cpupower idleinfo [options]\n"));
148 printf(_ ("Options:\n")); 147 printf(_ ("Options:\n"));
149 printf(_ (" -s, --silent Only show general C-state information\n")); 148 printf(_ (" -s, --silent Only show general C-state information\n"));
@@ -155,9 +154,9 @@ void idle_info_help(void) {
155} 154}
156 155
157static struct option info_opts[] = { 156static struct option info_opts[] = {
158 { .name="silent", .has_arg=no_argument, .flag=NULL, .val='s'}, 157 { .name = "silent", .has_arg = no_argument, .flag = NULL, .val = 's'},
159 { .name="proc", .has_arg=no_argument, .flag=NULL, .val='o'}, 158 { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'},
160 { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, 159 { .name = "help", .has_arg = no_argument, .flag = NULL, .val = 'h'},
161 { }, 160 { },
162}; 161};
163 162
@@ -202,7 +201,7 @@ int cmd_idle_info(int argc, char **argv)
202 output_param = ret; 201 output_param = ret;
203 break; 202 break;
204 } 203 }
205 } while(cont); 204 } while (cont);
206 205
207 switch (output_param) { 206 switch (output_param) {
208 case -1: 207 case -1:
@@ -219,10 +218,10 @@ int cmd_idle_info(int argc, char **argv)
219 /* Default is: show output of CPU 0 only */ 218 /* Default is: show output of CPU 0 only */
220 if (bitmask_isallclear(cpus_chosen)) 219 if (bitmask_isallclear(cpus_chosen))
221 bitmask_setbit(cpus_chosen, 0); 220 bitmask_setbit(cpus_chosen, 0);
222 221
223 if (output_param == 0) 222 if (output_param == 0)
224 cpuidle_general_output(); 223 cpuidle_general_output();
225 224
226 for (cpu = bitmask_first(cpus_chosen); 225 for (cpu = bitmask_first(cpus_chosen);
227 cpu <= bitmask_last(cpus_chosen); cpu++) { 226 cpu <= bitmask_last(cpus_chosen); cpu++) {
228 227
@@ -241,5 +240,5 @@ int cmd_idle_info(int argc, char **argv)
241 break; 240 break;
242 } 241 }
243 } 242 }
244 return (EXIT_SUCCESS); 243 return EXIT_SUCCESS;
245} 244}