Re: [PATCH] cpuidle/coupled: Init cpuidle_device::safe_state_index

From: Daniel Lezcano
Date: Mon Aug 03 2015 - 12:23:07 EST


On 07/23/2015 02:31 PM, Xunlei Pang wrote:
From: Xunlei Pang <pang.xunlei@xxxxxxxxxx>

cpuidle_device::safe_state_index need to be initialized before use,
so assign the driver's safe_state_index to it.

Signed-off-by: Xunlei Pang <pang.xunlei@xxxxxxxxxx>
---
drivers/cpuidle/cpuidle.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index e8e2775..ed5c8efe 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -585,6 +585,8 @@ int cpuidle_register(struct cpuidle_driver *drv,
*/
if (coupled_cpus)
device->coupled_cpus = *coupled_cpus;
+
+ device->safe_state_index = drv->safe_state_index;

Hey, good catch. We are lucky the safe_state_index is always zero.

I think we can simplify the code by removing the safe_state_index from the cpuidle_device structure and use the one in the cpuidle_driver structure in coupled.c




--
<http://www.linaro.org/> Linaro.org â Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/