[PATCH v2] cpupower : Handle set and info subcommands correctly

From: Abhishek Goel
Date: Fri Sep 13 2019 - 04:09:03 EST

Cpupower tool has set and info options which are being used only by
x86 machines. This patch removes support for these two subcommands
from generic cpupower utility. Thus, these two subcommands will now be
available only for intel.
This removes the ambiguous error message while using set option in case
of using non-intel systems.

Without this patch on a non-intel box:

root@ubuntu:~# cpupower info
System does not support Intel's performance bias setting

root@ubuntu:~# cpupower set -b 10
Error setting perf-bias value on CPU

With this patch on a non-intel box:

root@ubuntu:~# cpupower info
Supported commands are:

Same result for set subcommand.

This patch does not affect results on a intel box.

Signed-off-by: Abhishek Goel <huntbag@xxxxxxxxxxxxxxxxxx>
Acked-by: Thomas Renninger <trenn@xxxxxxx>

changes from v1:
Instead of bailing out early in set and info commands, in V2, we
are cutting out support for these two commands for non-intel

tools/power/cpupower/utils/cpupower.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/power/cpupower/utils/cpupower.c b/tools/power/cpupower/utils/cpupower.c
index 8e3d08042825..babb9ab3afb1 100644
--- a/tools/power/cpupower/utils/cpupower.c
+++ b/tools/power/cpupower/utils/cpupower.c
@@ -52,8 +52,10 @@ static struct cmd_struct commands[] = {
{ "frequency-set", cmd_freq_set, 1 },
{ "idle-info", cmd_idle_info, 0 },
{ "idle-set", cmd_idle_set, 1 },
+#if defined(__x86_64__) || defined(__i386__)
{ "set", cmd_set, 1 },
{ "info", cmd_info, 0 },
{ "monitor", cmd_monitor, 0 },
{ "help", cmd_help, 0 },
/* { "bench", cmd_bench, 1 }, */