diff options
author | Sriram Raghunathan <sriram@marirs.net.in> | 2015-10-23 03:52:45 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-11-01 20:28:59 -0500 |
commit | 57ab3b08725163bfe385aaeea6837f9b1213af3d (patch) | |
tree | ae161ce58eae6922ed2617c29d208c4fceb99012 /tools/power/cpupower | |
parent | 19c9fb896f54ade387676f134ce1de9bcd3cd478 (diff) |
Creating a common structure initialization pattern for struct option
This patch tries to creates a common structure initialization
within the cpupower tool.
Previously the ``struct option`` was initialized
using `designated initializer` technique which was
not needed. There were conflicting initialization methods seen with
bench/main.c & others.
Signed-off-by: Sriram Raghunathan <sriram@marirs.net.in>
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'tools/power/cpupower')
-rw-r--r-- | tools/power/cpupower/debug/i386/dump_psb.c | 2 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpufreq-info.c | 30 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpufreq-set.c | 10 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpuidle-info.c | 4 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpuidle-set.c | 14 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpupower-info.c | 4 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpupower-set.c | 2 |
7 files changed, 31 insertions, 35 deletions
diff --git a/tools/power/cpupower/debug/i386/dump_psb.c b/tools/power/cpupower/debug/i386/dump_psb.c index 8d6a47514253..2c768cf70128 100644 --- a/tools/power/cpupower/debug/i386/dump_psb.c +++ b/tools/power/cpupower/debug/i386/dump_psb.c | |||
@@ -134,7 +134,7 @@ next_one: | |||
134 | } | 134 | } |
135 | 135 | ||
136 | static struct option info_opts[] = { | 136 | static struct option info_opts[] = { |
137 | {.name = "numpst", .has_arg=no_argument, .flag=NULL, .val='n'}, | 137 | {"numpst", no_argument, NULL, 'n'}, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | void print_help(void) | 140 | void print_help(void) |
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c index b4b90a97662c..0e6764330241 100644 --- a/tools/power/cpupower/utils/cpufreq-info.c +++ b/tools/power/cpupower/utils/cpufreq-info.c | |||
@@ -536,21 +536,21 @@ static int get_latency(unsigned int cpu, unsigned int human) | |||
536 | } | 536 | } |
537 | 537 | ||
538 | static struct option info_opts[] = { | 538 | static struct option info_opts[] = { |
539 | { .name = "debug", .has_arg = no_argument, .flag = NULL, .val = 'e'}, | 539 | {"debug", no_argument, NULL, 'e'}, |
540 | { .name = "boost", .has_arg = no_argument, .flag = NULL, .val = 'b'}, | 540 | {"boost", no_argument, NULL, 'b'}, |
541 | { .name = "freq", .has_arg = no_argument, .flag = NULL, .val = 'f'}, | 541 | {"freq", no_argument, NULL, 'f'}, |
542 | { .name = "hwfreq", .has_arg = no_argument, .flag = NULL, .val = 'w'}, | 542 | {"hwfreq", no_argument, NULL, 'w'}, |
543 | { .name = "hwlimits", .has_arg = no_argument, .flag = NULL, .val = 'l'}, | 543 | {"hwlimits", no_argument, NULL, 'l'}, |
544 | { .name = "driver", .has_arg = no_argument, .flag = NULL, .val = 'd'}, | 544 | {"driver", no_argument, NULL, 'd'}, |
545 | { .name = "policy", .has_arg = no_argument, .flag = NULL, .val = 'p'}, | 545 | {"policy", no_argument, NULL, 'p'}, |
546 | { .name = "governors", .has_arg = no_argument, .flag = NULL, .val = 'g'}, | 546 | {"governors", no_argument, NULL, 'g'}, |
547 | { .name = "related-cpus", .has_arg = no_argument, .flag = NULL, .val = 'r'}, | 547 | {"related-cpus", no_argument, NULL, 'r'}, |
548 | { .name = "affected-cpus",.has_arg = no_argument, .flag = NULL, .val = 'a'}, | 548 | {"affected-cpus", no_argument, NULL, 'a'}, |
549 | { .name = "stats", .has_arg = no_argument, .flag = NULL, .val = 's'}, | 549 | {"stats", no_argument, NULL, 's'}, |
550 | { .name = "latency", .has_arg = no_argument, .flag = NULL, .val = 'y'}, | 550 | {"latency", no_argument, NULL, 'y'}, |
551 | { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, | 551 | {"proc", no_argument, NULL, 'o'}, |
552 | { .name = "human", .has_arg = no_argument, .flag = NULL, .val = 'm'}, | 552 | {"human", no_argument, NULL, 'm'}, |
553 | { .name = "no-rounding", .has_arg = no_argument, .flag = NULL, .val = 'n'}, | 553 | {"no-rounding", no_argument, NULL, 'n'}, |
554 | { }, | 554 | { }, |
555 | }; | 555 | }; |
556 | 556 | ||
diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c index 4e213576381e..0fbd1a22c0a9 100644 --- a/tools/power/cpupower/utils/cpufreq-set.c +++ b/tools/power/cpupower/utils/cpufreq-set.c | |||
@@ -22,11 +22,11 @@ | |||
22 | #define NORM_FREQ_LEN 32 | 22 | #define NORM_FREQ_LEN 32 |
23 | 23 | ||
24 | static struct option set_opts[] = { | 24 | static struct option set_opts[] = { |
25 | { .name = "min", .has_arg = required_argument, .flag = NULL, .val = 'd'}, | 25 | {"min", required_argument, NULL, 'd'}, |
26 | { .name = "max", .has_arg = required_argument, .flag = NULL, .val = 'u'}, | 26 | {"max", required_argument, NULL, 'u'}, |
27 | { .name = "governor", .has_arg = required_argument, .flag = NULL, .val = 'g'}, | 27 | {"governor", required_argument, NULL, 'g'}, |
28 | { .name = "freq", .has_arg = required_argument, .flag = NULL, .val = 'f'}, | 28 | {"freq", required_argument, NULL, 'f'}, |
29 | { .name = "related", .has_arg = no_argument, .flag = NULL, .val='r'}, | 29 | {"related", no_argument, NULL, 'r'}, |
30 | { }, | 30 | { }, |
31 | }; | 31 | }; |
32 | 32 | ||
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c index 75e66de7e7a7..750c1d82c3f7 100644 --- a/tools/power/cpupower/utils/cpuidle-info.c +++ b/tools/power/cpupower/utils/cpuidle-info.c | |||
@@ -126,8 +126,8 @@ static void proc_cpuidle_cpu_output(unsigned int cpu) | |||
126 | } | 126 | } |
127 | 127 | ||
128 | static struct option info_opts[] = { | 128 | static struct option info_opts[] = { |
129 | { .name = "silent", .has_arg = no_argument, .flag = NULL, .val = 's'}, | 129 | {"silent", no_argument, NULL, 's'}, |
130 | { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, | 130 | {"proc", no_argument, NULL, 'o'}, |
131 | { }, | 131 | { }, |
132 | }; | 132 | }; |
133 | 133 | ||
diff --git a/tools/power/cpupower/utils/cpuidle-set.c b/tools/power/cpupower/utils/cpuidle-set.c index eaea1301e29b..d6b6ae44b8c2 100644 --- a/tools/power/cpupower/utils/cpuidle-set.c +++ b/tools/power/cpupower/utils/cpuidle-set.c | |||
@@ -13,15 +13,11 @@ | |||
13 | #include "helpers/sysfs.h" | 13 | #include "helpers/sysfs.h" |
14 | 14 | ||
15 | static struct option info_opts[] = { | 15 | static struct option info_opts[] = { |
16 | { .name = "disable", | 16 | {"disable", required_argument, NULL, 'd'}, |
17 | .has_arg = required_argument, .flag = NULL, .val = 'd'}, | 17 | {"enable", required_argument, NULL, 'e'}, |
18 | { .name = "enable", | 18 | {"disable-by-latency", required_argument, NULL, 'D'}, |
19 | .has_arg = required_argument, .flag = NULL, .val = 'e'}, | 19 | {"enable-all", no_argument, NULL, 'E'}, |
20 | { .name = "disable-by-latency", | 20 | { }, |
21 | .has_arg = required_argument, .flag = NULL, .val = 'D'}, | ||
22 | { .name = "enable-all", | ||
23 | .has_arg = no_argument, .flag = NULL, .val = 'E'}, | ||
24 | { }, | ||
25 | }; | 21 | }; |
26 | 22 | ||
27 | 23 | ||
diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c index 136d979e9586..10299f2e9d2a 100644 --- a/tools/power/cpupower/utils/cpupower-info.c +++ b/tools/power/cpupower/utils/cpupower-info.c | |||
@@ -17,8 +17,8 @@ | |||
17 | #include "helpers/sysfs.h" | 17 | #include "helpers/sysfs.h" |
18 | 18 | ||
19 | static struct option set_opts[] = { | 19 | static struct option set_opts[] = { |
20 | { .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'}, | 20 | {"perf-bias", optional_argument, NULL, 'b'}, |
21 | { }, | 21 | { }, |
22 | }; | 22 | }; |
23 | 23 | ||
24 | static void print_wrong_arg_exit(void) | 24 | static void print_wrong_arg_exit(void) |
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c index 573c75f8e3f5..3e6f374f8dd7 100644 --- a/tools/power/cpupower/utils/cpupower-set.c +++ b/tools/power/cpupower/utils/cpupower-set.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include "helpers/bitmask.h" | 18 | #include "helpers/bitmask.h" |
19 | 19 | ||
20 | static struct option set_opts[] = { | 20 | static struct option set_opts[] = { |
21 | { .name = "perf-bias", .has_arg = required_argument, .flag = NULL, .val = 'b'}, | 21 | {"perf-bias", required_argument, NULL, 'b'}, |
22 | { }, | 22 | { }, |
23 | }; | 23 | }; |
24 | 24 | ||