summaryrefslogtreecommitdiff
path: root/tools/power
diff options
context:
space:
mode:
authorPrarit Bhargava <prarit@redhat.com>2019-10-10 13:29:41 -0700
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-10-15 11:02:29 +0300
commit210369dc73b23fab1b9727fba35c2f83d00b6277 (patch)
tree7840638c8a705e098af3a7b0ff20254b86230695 /tools/power
parentce1326a2f9f7bf8920bc7f07e7b13ce8737b4681 (diff)
tools/power/x86/intel-speed-select: Make process_command generic
Make the process_command take any help command and command list. This will make it easier to help commands and a command list for CascadeLake-N. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/intel-speed-select/isst-config.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index 4927aebee306..907b79e16c68 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -1816,7 +1816,9 @@ static struct process_cmd_help_struct isst_help_cmds[] = {
{ NULL, NULL }
};
-void process_command(int argc, char **argv)
+void process_command(int argc, char **argv,
+ struct process_cmd_help_struct *help_cmds,
+ struct process_cmd_struct *cmds)
{
int i = 0, matched = 0;
char *feature = argv[optind];
@@ -1827,9 +1829,9 @@ void process_command(int argc, char **argv)
debug_printf("feature name [%s] command [%s]\n", feature, cmd);
if (!strcmp(cmd, "-h") || !strcmp(cmd, "--help")) {
- while (isst_help_cmds[i].feature) {
- if (!strcmp(isst_help_cmds[i].feature, feature)) {
- isst_help_cmds[i].process_fn();
+ while (help_cmds[i].feature) {
+ if (!strcmp(help_cmds[i].feature, feature)) {
+ help_cmds[i].process_fn();
exit(0);
}
++i;
@@ -1839,11 +1841,11 @@ void process_command(int argc, char **argv)
create_cpu_map();
i = 0;
- while (isst_cmds[i].feature) {
- if (!strcmp(isst_cmds[i].feature, feature) &&
- !strcmp(isst_cmds[i].command, cmd)) {
+ while (cmds[i].feature) {
+ if (!strcmp(cmds[i].feature, feature) &&
+ !strcmp(cmds[i].command, cmd)) {
parse_cmd_args(argc, optind + 1, argv);
- isst_cmds[i].process_fn(isst_cmds[i].arg);
+ cmds[i].process_fn(cmds[i].arg);
matched = 1;
break;
}
@@ -1964,7 +1966,7 @@ static void cmdline(int argc, char **argv)
if (ret)
goto out;
- process_command(argc, argv);
+ process_command(argc, argv, isst_help_cmds, isst_cmds);
out:
free_cpu_set(present_cpumask);
free_cpu_set(target_cpumask);