2023-01-17 17:52:02

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] cpuidle: mvebu: fix duplicate flags assignment

From: Arnd Bergmann <[email protected]>

The added '.flags' value is sometimes ignored here because
it gets overwritten by another initialization:

drivers/cpuidle/cpuidle-mvebu-v7.c:24:33: error: initialized field overwritten [-Werror=override-init]
24 | #define MVEBU_V7_FLAG_DEEP_IDLE 0x10000
| ^~~~~~~
drivers/cpuidle/cpuidle-mvebu-v7.c:69:43: note: in expansion of macro 'MVEBU_V7_FLAG_DEEP_IDLE'
69 | .flags = MVEBU_V7_FLAG_DEEP_IDLE,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/cpuidle/cpuidle-mvebu-v7.c:24:33: note: (near initialization for 'armadaxp_idle_driver.states[2].flags')
24 | #define MVEBU_V7_FLAG_DEEP_IDLE 0x10000
| ^~~~~~~
drivers/cpuidle/cpuidle-mvebu-v7.c:69:43: note: in expansion of macro 'MVEBU_V7_FLAG_DEEP_IDLE'
69 | .flags = MVEBU_V7_FLAG_DEEP_IDLE,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/cpuidle/cpuidle-mvebu-v7.c:24:33: error: initialized field overwritten [-Werror=override-init]
24 | #define MVEBU_V7_FLAG_DEEP_IDLE 0x10000
| ^~~~~~~
drivers/cpuidle/cpuidle-mvebu-v7.c:85:43: note: in expansion of macro 'MVEBU_V7_FLAG_DEEP_IDLE'
85 | .flags = MVEBU_V7_FLAG_DEEP_IDLE,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/cpuidle/cpuidle-mvebu-v7.c:24:33: note: (near initialization for 'armada370_idle_driver.states[1].flags')
24 | #define MVEBU_V7_FLAG_DEEP_IDLE 0x10000
| ^~~~~~~
drivers/cpuidle/cpuidle-mvebu-v7.c:85:43: note: in expansion of macro 'MVEBU_V7_FLAG_DEEP_IDLE'
85 | .flags = MVEBU_V7_FLAG_DEEP_IDLE,
| ^~~~~~~~~~~~~~~~~~~~~~~

Merge the two fields into one.

Fixes: 4ce40e9dbe83 ("cpuidle, armada: Push RCU-idle into driver")
Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/cpuidle/cpuidle-mvebu-v7.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-mvebu-v7.c b/drivers/cpuidle/cpuidle-mvebu-v7.c
index 114bd09eebbf..563dba609b98 100644
--- a/drivers/cpuidle/cpuidle-mvebu-v7.c
+++ b/drivers/cpuidle/cpuidle-mvebu-v7.c
@@ -52,21 +52,20 @@ static struct cpuidle_driver armadaxp_idle_driver = {
.name = "armada_xp_idle",
.states[0] = ARM_CPUIDLE_WFI_STATE,
.states[1] = {
- .flags = CPUIDLE_FLAG_RCU_IDLE,
.enter = mvebu_v7_enter_idle,
.exit_latency = 100,
.power_usage = 50,
.target_residency = 1000,
+ .flags = CPUIDLE_FLAG_RCU_IDLE,
.name = "MV CPU IDLE",
.desc = "CPU power down",
},
.states[2] = {
- .flags = CPUIDLE_FLAG_RCU_IDLE,
.enter = mvebu_v7_enter_idle,
.exit_latency = 1000,
.power_usage = 5,
.target_residency = 10000,
- .flags = MVEBU_V7_FLAG_DEEP_IDLE,
+ .flags = MVEBU_V7_FLAG_DEEP_IDLE | CPUIDLE_FLAG_RCU_IDLE,
.name = "MV CPU DEEP IDLE",
.desc = "CPU and L2 Fabric power down",
},
@@ -77,12 +76,11 @@ static struct cpuidle_driver armada370_idle_driver = {
.name = "armada_370_idle",
.states[0] = ARM_CPUIDLE_WFI_STATE,
.states[1] = {
- .flags = CPUIDLE_FLAG_RCU_IDLE,
.enter = mvebu_v7_enter_idle,
.exit_latency = 100,
.power_usage = 5,
.target_residency = 1000,
- .flags = MVEBU_V7_FLAG_DEEP_IDLE,
+ .flags = MVEBU_V7_FLAG_DEEP_IDLE | CPUIDLE_FLAG_RCU_IDLE,
.name = "Deep Idle",
.desc = "CPU and L2 Fabric power down",
},
@@ -93,11 +91,11 @@ static struct cpuidle_driver armada38x_idle_driver = {
.name = "armada_38x_idle",
.states[0] = ARM_CPUIDLE_WFI_STATE,
.states[1] = {
- .flags = CPUIDLE_FLAG_RCU_IDLE,
.enter = mvebu_v7_enter_idle,
.exit_latency = 10,
.power_usage = 5,
.target_residency = 100,
+ .flags = CPUIDLE_FLAG_RCU_IDLE,
.name = "Idle",
.desc = "CPU and SCU power down",
},
--
2.39.0


2023-01-18 12:35:33

by tip-bot2 for Tony Luck

[permalink] [raw]
Subject: [tip: sched/core] cpuidle: mvebu: Fix duplicate flags assignment

The following commit has been merged into the sched/core branch of tip:

Commit-ID: 3b8645e9ec7eb42e7df7a367d6787a3af53f37a9
Gitweb: https://git.kernel.org/tip/3b8645e9ec7eb42e7df7a367d6787a3af53f37a9
Author: Arnd Bergmann <[email protected]>
AuthorDate: Tue, 17 Jan 2023 17:46:35 +01:00
Committer: Ingo Molnar <[email protected]>
CommitterDate: Wed, 18 Jan 2023 12:03:54 +01:00

cpuidle: mvebu: Fix duplicate flags assignment

The added '.flags' value is sometimes ignored here because
it gets overwritten by another initialization:

drivers/cpuidle/cpuidle-mvebu-v7.c:24:33: error: initialized field overwritten [-Werror=override-init]
24 | #define MVEBU_V7_FLAG_DEEP_IDLE 0x10000
| ^~~~~~~
drivers/cpuidle/cpuidle-mvebu-v7.c:69:43: note: in expansion of macro 'MVEBU_V7_FLAG_DEEP_IDLE'
...

Merge the two fields into one.

Fixes: 4ce40e9dbe83 ("cpuidle, armada: Push RCU-idle into driver")
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
drivers/cpuidle/cpuidle-mvebu-v7.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-mvebu-v7.c b/drivers/cpuidle/cpuidle-mvebu-v7.c
index 114bd09..563dba6 100644
--- a/drivers/cpuidle/cpuidle-mvebu-v7.c
+++ b/drivers/cpuidle/cpuidle-mvebu-v7.c
@@ -52,21 +52,20 @@ static struct cpuidle_driver armadaxp_idle_driver = {
.name = "armada_xp_idle",
.states[0] = ARM_CPUIDLE_WFI_STATE,
.states[1] = {
- .flags = CPUIDLE_FLAG_RCU_IDLE,
.enter = mvebu_v7_enter_idle,
.exit_latency = 100,
.power_usage = 50,
.target_residency = 1000,
+ .flags = CPUIDLE_FLAG_RCU_IDLE,
.name = "MV CPU IDLE",
.desc = "CPU power down",
},
.states[2] = {
- .flags = CPUIDLE_FLAG_RCU_IDLE,
.enter = mvebu_v7_enter_idle,
.exit_latency = 1000,
.power_usage = 5,
.target_residency = 10000,
- .flags = MVEBU_V7_FLAG_DEEP_IDLE,
+ .flags = MVEBU_V7_FLAG_DEEP_IDLE | CPUIDLE_FLAG_RCU_IDLE,
.name = "MV CPU DEEP IDLE",
.desc = "CPU and L2 Fabric power down",
},
@@ -77,12 +76,11 @@ static struct cpuidle_driver armada370_idle_driver = {
.name = "armada_370_idle",
.states[0] = ARM_CPUIDLE_WFI_STATE,
.states[1] = {
- .flags = CPUIDLE_FLAG_RCU_IDLE,
.enter = mvebu_v7_enter_idle,
.exit_latency = 100,
.power_usage = 5,
.target_residency = 1000,
- .flags = MVEBU_V7_FLAG_DEEP_IDLE,
+ .flags = MVEBU_V7_FLAG_DEEP_IDLE | CPUIDLE_FLAG_RCU_IDLE,
.name = "Deep Idle",
.desc = "CPU and L2 Fabric power down",
},
@@ -93,11 +91,11 @@ static struct cpuidle_driver armada38x_idle_driver = {
.name = "armada_38x_idle",
.states[0] = ARM_CPUIDLE_WFI_STATE,
.states[1] = {
- .flags = CPUIDLE_FLAG_RCU_IDLE,
.enter = mvebu_v7_enter_idle,
.exit_latency = 10,
.power_usage = 5,
.target_residency = 100,
+ .flags = CPUIDLE_FLAG_RCU_IDLE,
.name = "Idle",
.desc = "CPU and SCU power down",
},