linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpuidle: dt: bail out if the idle-state DT node is not compatible
@ 2019-01-31  2:27 Joseph Lo
  2019-01-31 10:38 ` Sudeep Holla
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Lo @ 2019-01-31  2:27 UTC (permalink / raw)
  To: Rafael J . Wysocki, Daniel Lezcano
  Cc: linux-tegra, Joseph Lo, linux-arm-kernel, linux-pm

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 <josephl@nvidia.com>
---
 drivers/cpuidle/dt_idle_states.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c
index 53342b7f1010..4a528908abb3 100644
--- a/drivers/cpuidle/dt_idle_states.c
+++ b/drivers/cpuidle/dt_idle_states.c
@@ -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;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpuidle: dt: bail out if the idle-state DT node is not compatible
  2019-01-31  2:27 [PATCH] cpuidle: dt: bail out if the idle-state DT node is not compatible Joseph Lo
@ 2019-01-31 10:38 ` Sudeep Holla
  2019-02-01  1:42   ` Joseph Lo
  0 siblings, 1 reply; 3+ messages in thread
From: Sudeep Holla @ 2019-01-31 10:38 UTC (permalink / raw)
  To: Joseph Lo
  Cc: linux-pm, Daniel Lezcano, Rafael J . Wysocki, Sudeep Holla,
	linux-tegra, linux-arm-kernel

On Thu, Jan 31, 2019 at 10:27:49AM +0800, Joseph Lo wrote:
> 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 <josephl@nvidia.com>
> ---
>  drivers/cpuidle/dt_idle_states.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c
> index 53342b7f1010..4a528908abb3 100644
> --- a/drivers/cpuidle/dt_idle_states.c
> +++ b/drivers/cpuidle/dt_idle_states.c
> @@ -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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpuidle: dt: bail out if the idle-state DT node is not compatible
  2019-01-31 10:38 ` Sudeep Holla
@ 2019-02-01  1:42   ` Joseph Lo
  0 siblings, 0 replies; 3+ messages in thread
From: Joseph Lo @ 2019-02-01  1:42 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: linux-tegra, Daniel Lezcano, Rafael J . Wysocki,
	linux-arm-kernel, linux-pm

On 1/31/19 6:38 PM, Sudeep Holla wrote:
> On Thu, Jan 31, 2019 at 10:27:49AM +0800, Joseph Lo wrote:
>> 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 <josephl@nvidia.com>
>> ---
>>   drivers/cpuidle/dt_idle_states.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c
>> index 53342b7f1010..4a528908abb3 100644
>> --- a/drivers/cpuidle/dt_idle_states.c
>> +++ b/drivers/cpuidle/dt_idle_states.c
>> @@ -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.

Yes, that would be even better.

Thanks,
Joseph

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-01  1:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31  2:27 [PATCH] cpuidle: dt: bail out if the idle-state DT node is not compatible Joseph Lo
2019-01-31 10:38 ` Sudeep Holla
2019-02-01  1:42   ` Joseph Lo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).