cpuidle: dt: bail out if the idle-state DT node is not compatible
Subsystems (2)
PATCH 1/1 cpuidle: dt: bail out if the idle-state DT node is not compatible
Currently, the DT of the idle states will be parsed first whether it's compatible or not. This could cause a warning message that comes from if the CPU doesn't support identical idle states. E.g. Tegra186 can run with 2 Cortex-A57 and 2 Denver cores with different idle states on different types of these cores.
We fix it to check the compatible string before the parsing procedures. So it can make sure it only goes through the idle states that the CPU supported.
--- drivers/cpuidle/dt_idle_states.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/cpuidle/dt_idle_states.c +5 -0
@@ -180,6 +180,11 @@ int dt_init_idle_driver(struct cpuidle_driver *drv,if (!state_node)break ; +if (!of_device_is_compatible (state_node, matches->compatible)) { + err = -EINVAL ; +break ; + } +if (!of_device_is_available (state_node)) {of_node_put (state_node);continue ;
Signature · 1 line
2.20.1
Quoted 20 lines · Joseph Lo
Currently, the DT of the idle states will be parsed first whether it's compatible or not. This could cause a warning message that comes from if the CPU doesn't support identical idle states. E.g. Tegra186 can run with 2 Cortex-A57 and 2 Denver cores with different idle states on different types of these cores.
We fix it to check the compatible string before the parsing procedures. So it can make sure it only goes through the idle states that the CPU supported.
Signed-off-by Joseph Lo <[email protected]>--- drivers/cpuidle/dt_idle_states.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/cpuidle/dt_idle_states.c +0
-0
drivers/cpuidle/dt_idle_states.c int dt_init_idle_driver(struct cpuidle_driver *drv, · line 187
Quoted 8 lines
drivers/cpuidle/dt_idle_states.c +5
-0@@ -180,6 +180,11 @@ int dt_init_idle_driver(struct cpuidle_driver *drv,if (!state_node)break ; +if (!of_device_is_compatible (state_node, matches->compatible)) { + err = -EINVAL ; +break ; + } +
Does it make sense to use of_match_node to get the matching device id and just pass that to init_state_node instead of the complete array to find the match.
--
Regards,
Sudeep
Quoted 24 lines · Sudeep Holla
Quoted 23 lines · Joseph Lo
Currently, the DT of the idle states will be parsed first whether it's compatible or not. This could cause a warning message that comes from if the CPU doesn't support identical idle states. E.g. Tegra186 can run with 2 Cortex-A57 and 2 Denver cores with different idle states on different types of these cores.
We fix it to check the compatible string before the parsing procedures. So it can make sure it only goes through the idle states that the CPU supported.
Signed-off-by Joseph Lo <[email protected]>--- drivers/cpuidle/dt_idle_states.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/cpuidle/dt_idle_states.c +0
-0@@ -180,6 +180,11 @@ int dt_init_idle_driver(struct cpuidle_driver *drv,if (!state_node)break ;
Quoted 9 lines
drivers/cpuidle/dt_idle_states.c int dt_init_idle_driver(struct cpuidle_driver *drv, · line 187
Quoted 5 lines
drivers/cpuidle/dt_idle_states.c +5
-0+if (!of_device_is_compatible (state_node, matches->compatible)) { + err = -EINVAL ; +break ; + } +Does it make sense to use
of_match_nodeto get the matching device id and just pass that toinit_state_nodeinstead of the complete array to find the match.
Yes, that would be even better.
Thanks,
Joseph