Skip to contentSkip to conversation

tools/power/cpupower: Fix initializer override in hsw_ext_cstates

PATCH In review Nathan Chancellor 2 participants 2 messages Sep 27, 2019 CPU power monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/power/cpupower: Fix initializer override in hsw_ext_cstates

When building cpupower with clang, the following warning appears:

utils/idle_monitor/hsw_ext_idle.c:42:16: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
.desc = N_("Processor Package C2"),
^~~~~~~~~~~~~~~~~~~~~~
./utils/helpers/helpers.h:25:33: note: expanded from macro 'N_'

 #define N_(String) gettext_noop(String)
                                 ^~~~~~
 ./utils/helpers/helpers.h:23:30: note: expanded from macro
 'gettext_noop'
 #define gettext_noop(String) String
                              ^~~~~~
 utils/idle_monitor/hsw_ext_idle.c:41:16: note: previous initialization
 is here
                 .desc                   = N_("Processor Package C9"),
                                              ^~~~~~~~~~~~~~~~~~~~~~
 ./utils/helpers/helpers.h:25:33: note: expanded from macro 'N_'
 #define N_(String) gettext_noop(String)
                                 ^~~~~~
 ./utils/helpers/helpers.h:23:30: note: expanded from macro
 'gettext_noop'
 #define gettext_noop(String) String
                             ^~~~~~

1 warning generated.

This appears to be a copy and paste or merge mistake because the name and id fields both have PC9 in them, not PC2. Remove the second assignment to fix the warning.

Fixes 7ee767b69b68 ("cpupower: Add Haswell family 0x45 specific idle monitor to show PC8,9,10 states")
---
 tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c | 1 -
 1 file changed, 1 deletion(-)
tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c +0 -1
index 7c7451d3f494..58dbdfd4fa13 100644
@@ -39,7 +39,6 @@ static cstate_t hsw_ext_cstates[HSW_EXT_CSTATE_COUNT] = {
 	{
 		.name			= "PC9",
 		.desc			= N_("Processor Package C9"),
-		.desc			= N_("Processor Package C2"),
 		.id			= PC9,
 		.range			= RANGE_PACKAGE,
 		.get_count_percent	= hsw_ext_get_count_percent,
Signature · 1 line
2.23.0
maintainer
#1 lore raw
Quoted 43 lines · Nathan Chancellor

When building cpupower with clang, the following warning appears:

  utils/idle_monitor/hsw_ext_idle.c:42:16: warning: initializer overrides
  prior initialization of this subobject [-Winitializer-overrides]
                  .desc                   = N_("Processor Package C2"),
                                               ^~~~~~~~~~~~~~~~~~~~~~
  ./utils/helpers/helpers.h:25:33: note: expanded from macro 'N_'
  #define N_(String) gettext_noop(String)
                                  ^~~~~~
  ./utils/helpers/helpers.h:23:30: note: expanded from macro
  'gettext_noop'
  #define gettext_noop(String) String
                               ^~~~~~
  utils/idle_monitor/hsw_ext_idle.c:41:16: note: previous initialization
  is here
                  .desc                   = N_("Processor Package C9"),
                                               ^~~~~~~~~~~~~~~~~~~~~~
  ./utils/helpers/helpers.h:25:33: note: expanded from macro 'N_'
  #define N_(String) gettext_noop(String)
                                  ^~~~~~
  ./utils/helpers/helpers.h:23:30: note: expanded from macro
  'gettext_noop'
  #define gettext_noop(String) String
                              ^~~~~~
  1 warning generated.

This appears to be a copy and paste or merge mistake because the name and id fields both have PC9 in them, not PC2. Remove the second assignment to fix the warning.

Fixes 7ee767b69b68 ("cpupower: Add Haswell family 0x45 specific idle monitor to show PC8,9,10 states")
---
  tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c | 1 -
  1 file changed, 1 deletion(-)
tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c +0 -0
index 7c7451d3f494..58dbdfd4fa13 100644

tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c static cstate_t hsw_ext_cstates[HSW_EXT_CSTATE_COUNT] = { · line 44

Quoted 7 lines
tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c +0 -1
@@ -39,7 +39,6 @@ static cstate_t hsw_ext_cstates[HSW_EXT_CSTATE_COUNT] = {
  	{
  		.name			= "PC9",
  		.desc			= N_("Processor Package C9"),
-		.desc			= N_("Processor Package C2"),
  		.id			= PC9,
  		.range			= RANGE_PACKAGE,
  		.get_count_percent	= hsw_ext_get_count_percent,

Looks good to me. I will queue this up for 5.4-rc2 or rc3.

thanks,
-- Shuah