Commit 57ab3b08 authored by Sriram Raghunathan's avatar Sriram Raghunathan Committed by Rafael J. Wysocki

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: default avatarSriram Raghunathan <sriram@marirs.net.in>
Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 19c9fb89
...@@ -134,7 +134,7 @@ void decode_psb(char *p, int numpst) ...@@ -134,7 +134,7 @@ void decode_psb(char *p, int numpst)
} }
static struct option info_opts[] = { static struct option info_opts[] = {
{.name = "numpst", .has_arg=no_argument, .flag=NULL, .val='n'}, {"numpst", no_argument, NULL, 'n'},
}; };
void print_help(void) void print_help(void)
......
...@@ -536,21 +536,21 @@ static int get_latency(unsigned int cpu, unsigned int human) ...@@ -536,21 +536,21 @@ static int get_latency(unsigned int cpu, unsigned int human)
} }
static struct option info_opts[] = { static struct option info_opts[] = {
{ .name = "debug", .has_arg = no_argument, .flag = NULL, .val = 'e'}, {"debug", no_argument, NULL, 'e'},
{ .name = "boost", .has_arg = no_argument, .flag = NULL, .val = 'b'}, {"boost", no_argument, NULL, 'b'},
{ .name = "freq", .has_arg = no_argument, .flag = NULL, .val = 'f'}, {"freq", no_argument, NULL, 'f'},
{ .name = "hwfreq", .has_arg = no_argument, .flag = NULL, .val = 'w'}, {"hwfreq", no_argument, NULL, 'w'},
{ .name = "hwlimits", .has_arg = no_argument, .flag = NULL, .val = 'l'}, {"hwlimits", no_argument, NULL, 'l'},
{ .name = "driver", .has_arg = no_argument, .flag = NULL, .val = 'd'}, {"driver", no_argument, NULL, 'd'},
{ .name = "policy", .has_arg = no_argument, .flag = NULL, .val = 'p'}, {"policy", no_argument, NULL, 'p'},
{ .name = "governors", .has_arg = no_argument, .flag = NULL, .val = 'g'}, {"governors", no_argument, NULL, 'g'},
{ .name = "related-cpus", .has_arg = no_argument, .flag = NULL, .val = 'r'}, {"related-cpus", no_argument, NULL, 'r'},
{ .name = "affected-cpus",.has_arg = no_argument, .flag = NULL, .val = 'a'}, {"affected-cpus", no_argument, NULL, 'a'},
{ .name = "stats", .has_arg = no_argument, .flag = NULL, .val = 's'}, {"stats", no_argument, NULL, 's'},
{ .name = "latency", .has_arg = no_argument, .flag = NULL, .val = 'y'}, {"latency", no_argument, NULL, 'y'},
{ .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, {"proc", no_argument, NULL, 'o'},
{ .name = "human", .has_arg = no_argument, .flag = NULL, .val = 'm'}, {"human", no_argument, NULL, 'm'},
{ .name = "no-rounding", .has_arg = no_argument, .flag = NULL, .val = 'n'}, {"no-rounding", no_argument, NULL, 'n'},
{ }, { },
}; };
......
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
#define NORM_FREQ_LEN 32 #define NORM_FREQ_LEN 32
static struct option set_opts[] = { static struct option set_opts[] = {
{ .name = "min", .has_arg = required_argument, .flag = NULL, .val = 'd'}, {"min", required_argument, NULL, 'd'},
{ .name = "max", .has_arg = required_argument, .flag = NULL, .val = 'u'}, {"max", required_argument, NULL, 'u'},
{ .name = "governor", .has_arg = required_argument, .flag = NULL, .val = 'g'}, {"governor", required_argument, NULL, 'g'},
{ .name = "freq", .has_arg = required_argument, .flag = NULL, .val = 'f'}, {"freq", required_argument, NULL, 'f'},
{ .name = "related", .has_arg = no_argument, .flag = NULL, .val='r'}, {"related", no_argument, NULL, 'r'},
{ }, { },
}; };
......
...@@ -126,8 +126,8 @@ static void proc_cpuidle_cpu_output(unsigned int cpu) ...@@ -126,8 +126,8 @@ static void proc_cpuidle_cpu_output(unsigned int cpu)
} }
static struct option info_opts[] = { static struct option info_opts[] = {
{ .name = "silent", .has_arg = no_argument, .flag = NULL, .val = 's'}, {"silent", no_argument, NULL, 's'},
{ .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, {"proc", no_argument, NULL, 'o'},
{ }, { },
}; };
......
...@@ -13,14 +13,10 @@ ...@@ -13,14 +13,10 @@
#include "helpers/sysfs.h" #include "helpers/sysfs.h"
static struct option info_opts[] = { static struct option info_opts[] = {
{ .name = "disable", {"disable", required_argument, NULL, 'd'},
.has_arg = required_argument, .flag = NULL, .val = 'd'}, {"enable", required_argument, NULL, 'e'},
{ .name = "enable", {"disable-by-latency", required_argument, NULL, 'D'},
.has_arg = required_argument, .flag = NULL, .val = 'e'}, {"enable-all", no_argument, NULL, 'E'},
{ .name = "disable-by-latency",
.has_arg = required_argument, .flag = NULL, .val = 'D'},
{ .name = "enable-all",
.has_arg = no_argument, .flag = NULL, .val = 'E'},
{ }, { },
}; };
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "helpers/sysfs.h" #include "helpers/sysfs.h"
static struct option set_opts[] = { static struct option set_opts[] = {
{ .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'}, {"perf-bias", optional_argument, NULL, 'b'},
{ }, { },
}; };
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "helpers/bitmask.h" #include "helpers/bitmask.h"
static struct option set_opts[] = { static struct option set_opts[] = {
{ .name = "perf-bias", .has_arg = required_argument, .flag = NULL, .val = 'b'}, {"perf-bias", required_argument, NULL, 'b'},
{ }, { },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment