mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] tools/power/x86/intel-speed-select: Fix some program return value
@ 2026-03-19  5:52 Zhang Rui
  2026-03-19  5:52 ` [PATCH 2/3] tools/power/x86/intel-speed-select: Print Version info when Incompatible API version is detected Zhang Rui
  2026-03-19  5:52 ` [PATCH 3/3] tools/power/x86/intel-speed-select: Fix output when running on unsupported CLX platforms Zhang Rui
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Rui @ 2026-03-19  5:52 UTC (permalink / raw)
  To: srinivas.pandruvada; +Cc: linux-kernel, platform-driver-x86

When running the "intel-speed-select -h" command, it returns
1. 0 when using a version that is API incompatible.
2. 1 when using a version that is API compatible.
And this is confusing.

Fix the program to return 0 for "-h" parameter, and return 1 whenever
"Incompatible API versions" is detected.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 tools/power/x86/intel-speed-select/isst-config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index dd9056ddb016..bd9f7a1d385e 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -1138,7 +1138,7 @@ static int isst_fill_platform_info(void)
 
 	if (isst_platform_info.api_version > supported_api_ver) {
 		printf("Incompatible API versions; Upgrade of tool is required\n");
-		return -1;
+		exit(1);
 	}
 
 set_platform_ops:
@@ -3191,7 +3191,7 @@ static void usage(void)
 		printf("\tTo get full turbo-freq information dump:\n");
 		printf("\t\tintel-speed-select turbo-freq info -l 0\n");
 	}
-	exit(1);
+	exit(0);
 }
 
 static void print_version(void)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/3] tools/power/x86/intel-speed-select: Print Version info when Incompatible API version is detected
  2026-03-19  5:52 [PATCH 1/3] tools/power/x86/intel-speed-select: Fix some program return value Zhang Rui
@ 2026-03-19  5:52 ` Zhang Rui
  2026-03-19  5:52 ` [PATCH 3/3] tools/power/x86/intel-speed-select: Fix output when running on unsupported CLX platforms Zhang Rui
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2026-03-19  5:52 UTC (permalink / raw)
  To: srinivas.pandruvada; +Cc: linux-kernel, platform-driver-x86

When running an old version intel-speed-select tool on newer platforms,
even with "intel-speed-select -v", the tool only complains about
"Incompatible API version", without giving the current version info.

Print Version info whenever Incompatible API version is detected.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 tools/power/x86/intel-speed-select/isst-config.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index bd9f7a1d385e..afef3af8b446 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -82,6 +82,11 @@ struct cpu_topology {
 
 static int read_only;
 
+static void print_version(void)
+{
+	fprintf(outf, "Version %s\n", version_str);
+}
+
 static void check_privilege(void)
 {
 	if (!read_only)
@@ -1137,6 +1142,7 @@ static int isst_fill_platform_info(void)
 	close(fd);
 
 	if (isst_platform_info.api_version > supported_api_ver) {
+		print_version();
 		printf("Incompatible API versions; Upgrade of tool is required\n");
 		exit(1);
 	}
@@ -3194,12 +3200,6 @@ static void usage(void)
 	exit(0);
 }
 
-static void print_version(void)
-{
-	fprintf(outf, "Version %s\n", version_str);
-	exit(0);
-}
-
 static void cmdline(int argc, char **argv)
 {
 	const char *pathname = "/dev/isst_interface";
@@ -3311,6 +3311,7 @@ static void cmdline(int argc, char **argv)
 			break;
 		case 'v':
 			print_version();
+			exit(0);
 			break;
 		case 'b':
 			oob_mode = 1;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 3/3] tools/power/x86/intel-speed-select: Fix output when running on unsupported CLX platforms
  2026-03-19  5:52 [PATCH 1/3] tools/power/x86/intel-speed-select: Fix some program return value Zhang Rui
  2026-03-19  5:52 ` [PATCH 2/3] tools/power/x86/intel-speed-select: Print Version info when Incompatible API version is detected Zhang Rui
@ 2026-03-19  5:52 ` Zhang Rui
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2026-03-19  5:52 UTC (permalink / raw)
  To: srinivas.pandruvada; +Cc: linux-kernel, platform-driver-x86

When running intel-speed-select on unsupported CLX platforms, it prints
 intel-speed-select: Invalid CPU model (85)
 : Success
Because this is not a system error and errno is not set.

Replace err() with exit().

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 tools/power/x86/intel-speed-select/isst-config.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index afef3af8b446..24be39c69a60 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -3246,8 +3246,10 @@ static void cmdline(int argc, char **argv)
 	}
 
 	ret = update_cpu_model();
-	if (ret)
-		err(-1, "Invalid CPU model (%d)\n", cpu_model);
+	if (ret) {
+		fprintf(stderr, "Invalid CPU model (%d)\n", cpu_model);
+		exit(1);
+	}
 	printf("Intel(R) Speed Select Technology\n");
 	printf("Executing on CPU model:%d[0x%x]\n", cpu_model, cpu_model);
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-19  5:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-19  5:52 [PATCH 1/3] tools/power/x86/intel-speed-select: Fix some program return value Zhang Rui
2026-03-19  5:52 ` [PATCH 2/3] tools/power/x86/intel-speed-select: Print Version info when Incompatible API version is detected Zhang Rui
2026-03-19  5:52 ` [PATCH 3/3] tools/power/x86/intel-speed-select: Fix output when running on unsupported CLX platforms Zhang Rui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®