linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: andriy.shevchenko@intel.com
Cc: prarit@redhat.com, platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [RESEND][PATCH 06/10] tools/power/x86/intel-speed-select: Make process_command generic
Date: Thu, 10 Oct 2019 13:29:41 -0700	[thread overview]
Message-ID: <20191010202945.73616-7-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <20191010202945.73616-1-srinivas.pandruvada@linux.intel.com>

From: Prarit Bhargava <prarit@redhat.com>

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>
---
 .../x86/intel-speed-select/isst-config.c      | 20 ++++++++++---------
 1 file 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);
-- 
2.17.2


  parent reply	other threads:[~2019-10-10 20:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 20:29 [RESEND][PATCH 00/10] intel-speed-select tool updates targetted for 5.5 Srinivas Pandruvada
2019-10-10 20:29 ` [RESEND][PATCH 01/10] tools/power/x86/intel-speed-select: Remove warning for unused result Srinivas Pandruvada
2019-10-10 20:29 ` [RESEND][PATCH 02/10] tools/power/x86/intel-speed-select: Base-freq feature auto mode Srinivas Pandruvada
2019-10-10 20:29 ` [RESEND][PATCH 03/10] tools/power/x86/intel-speed-select: Turbo-freq " Srinivas Pandruvada
2019-10-10 20:29 ` [RESEND][PATCH 04/10] tools/power/x86/intel-speed-select: Refuse to disable core-power when getting used Srinivas Pandruvada
2019-10-10 20:29 ` [RESEND][PATCH 05/10] tools/power/x86/intel-speed-select: Add int argument to command functions Srinivas Pandruvada
2019-10-10 20:29 ` Srinivas Pandruvada [this message]
2019-10-10 20:29 ` [RESEND][PATCH 07/10] tools/power/x86/intel-speed-select: Add check for CascadeLake-N models Srinivas Pandruvada
2019-10-10 20:29 ` [RESEND][PATCH 08/10] tools/power/x86/intel-speed-select: Implement CascadeLake-N help and command functions structures Srinivas Pandruvada
2019-10-10 20:29 ` [RESEND][PATCH 09/10] tools/power/x86/intel-speed-select: Implement 'perf-profile info' on CascadeLake-N Srinivas Pandruvada
2019-10-10 20:29 ` [RESEND][PATCH 10/10] tools/power/x86/intel-speed-select: Implement base-freq commands " Srinivas Pandruvada
2019-11-05 18:21 ` [RESEND][PATCH 00/10] intel-speed-select tool updates targetted for 5.5 Prarit Bhargava
2019-11-05 19:21   ` Srinivas Pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191010202945.73616-7-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=prarit@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).