tools/power/x86/intel-speed-select: Fix some program return value
Subsystems (2)
PATCH 1/3 tools/power/x86/intel-speed-select: Fix some program return value
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.
--- tools/power/x86/intel-speed-select/isst-config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +2 -2
@@ -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 )
Signature · 1 line
2.43.0
PATCH 2/3 tools/power/x86/intel-speed-select: Print Version info when Incompatible API version is detected
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.
--- tools/power/x86/intel-speed-select/isst-config.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +7 -6
@@ -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 ;
Signature · 1 line
2.43.0
PATCH 3/3 tools/power/x86/intel-speed-select: Fix output when running on unsupported CLX platforms
In reply to Zhang RuiWhen 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().
--- tools/power/x86/intel-speed-select/isst-config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/power/x86/intel-speed-select/isst-config.c +4 -2
@@ -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);
Signature · 1 line
2.43.0