Skip to contentSkip to conversation

cpupower: Change the var type of the 'monitor' subcommand display mode

PATCH In review Roman Storozhenko 2 participants 2 messages Jun 20, 2024 CPU power monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cpupower: Change the var type of the 'monitor' subcommand display mode

There is a type 'enum operation_mode_e' contains the display modes of the 'monitor' subcommand. This type isn't used though, instead the variable 'mode' is of a simple 'int' type.
Change 'mode' variable type from 'int' to 'enum operation_mode_e' in order to improve compiler type checking.
Built and tested this with different monitor cmdline params. Everything works as expected, that is nothing changed and no regressions encountered.

---
Changes in v2:
- Moved cover letter content to the change log
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +1 -1
index 075e766ff1f3..f746099b5dac 100644
@@ -35,7 +35,7 @@ static unsigned int avail_monitors;
 static char *progname;
 
 enum operation_mode_e { list = 1, show, show_all };
-static int mode;
+static enum operation_mode_e mode;
 static int interval = 1;
 static char *show_monitors_param;
 static struct cpupower_topology cpu_top;

---
base-commit: 0c52056d9f77508cb6d4d68d3fc91c6c08ec71af
change-id: 20240619-change-mode-type-e8de8430ccca

Best regards,

Signature · 1 line
Roman Storozhenko <[email protected]>
maintainer
#1 lore raw
Quoted 8 lines · Roman Storozhenko

There is a type 'enum operation_mode_e' contains the display modes of the 'monitor' subcommand. This type isn't used though, instead the variable 'mode' is of a simple 'int' type.
Change 'mode' variable type from 'int' to 'enum operation_mode_e' in order to improve compiler type checking.
Built and tested this with different monitor cmdline params. Everything works as expected, that is nothing changed and no regressions encountered.

Quoted 5 lines

---
Changes in v2:
- Moved cover letter content to the change log
- Link to v1: https://lore.kernel.org/r/[email protected]

Applied for Linux 6.11-rc1
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git/log/?h=cpupower

thanks,
-- Shuah