diff mbox

of: return of_get_cpu_node from of_cpu_device_node_get if CPUs are not registered

Message ID 1500904513-10483-1-git-send-email-sudeep.holla@arm.com
State Superseded
Headers show

Commit Message

Sudeep Holla July 24, 2017, 1:55 p.m. UTC
Instead of the callsites choosing between of_cpu_device_node_get if the
CPUs are registered as of_node is populated by then and of_get_cpu_node
when the CPUs are not yet registered as CPU of_nodes are not yet stashed
thereby needing to parse the device tree, we can call of_get_cpu_node
in case the CPUs are not yet registered.

This will allow to use of_cpu_device_node_get anywhere hiding the
details from the caller.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

---
 include/linux/of_device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hi Rob,

Let me know if you are OK with this change. I keep seeing different
drivers calling of_get_cpu_node or of_cpu_device_node_get based on what
they are aware of or copying from other place without knowing the
details. I am trying to avoid that and ask to use of_cpu_device_node_get
at all places instead.

Regards,
Sudeep

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Rob Herring July 24, 2017, 4 p.m. UTC | #1
On Mon, Jul 24, 2017 at 8:55 AM, Sudeep Holla <sudeep.holla@arm.com> wrote:
> Instead of the callsites choosing between of_cpu_device_node_get if the

> CPUs are registered as of_node is populated by then and of_get_cpu_node

> when the CPUs are not yet registered as CPU of_nodes are not yet stashed

> thereby needing to parse the device tree, we can call of_get_cpu_node

> in case the CPUs are not yet registered.

>

> This will allow to use of_cpu_device_node_get anywhere hiding the

> details from the caller.

>

> Cc: Rob Herring <robh+dt@kernel.org>

> Cc: Frank Rowand <frowand.list@gmail.com>

> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

> ---

>  include/linux/of_device.h | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> Hi Rob,

>

> Let me know if you are OK with this change. I keep seeing different

> drivers calling of_get_cpu_node or of_cpu_device_node_get based on what

> they are aware of or copying from other place without knowing the

> details. I am trying to avoid that and ask to use of_cpu_device_node_get

> at all places instead.


Seems fine to me.

Acked-by: Rob Herring <robh@kernel.org>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sudeep Holla July 24, 2017, 4:32 p.m. UTC | #2
On 24/07/17 17:00, Rob Herring wrote:
> On Mon, Jul 24, 2017 at 8:55 AM, Sudeep Holla <sudeep.holla@arm.com> wrote:

>> Instead of the callsites choosing between of_cpu_device_node_get if the

>> CPUs are registered as of_node is populated by then and of_get_cpu_node

>> when the CPUs are not yet registered as CPU of_nodes are not yet stashed

>> thereby needing to parse the device tree, we can call of_get_cpu_node

>> in case the CPUs are not yet registered.

>>

>> This will allow to use of_cpu_device_node_get anywhere hiding the

>> details from the caller.

>>

>> Cc: Rob Herring <robh+dt@kernel.org>

>> Cc: Frank Rowand <frowand.list@gmail.com>

>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

>> ---

>>  include/linux/of_device.h | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> Hi Rob,

>>

>> Let me know if you are OK with this change. I keep seeing different

>> drivers calling of_get_cpu_node or of_cpu_device_node_get based on what

>> they are aware of or copying from other place without knowing the

>> details. I am trying to avoid that and ask to use of_cpu_device_node_get

>> at all places instead.

> 

> Seems fine to me.

> 

> Acked-by: Rob Herring <robh@kernel.org>

> 


Thanks. Can you take it through your tree itself ? I can make any follow
patches(if any) once this lands in the tree. I don't have any for now
just to avoid all cross dependencies.

-- 
Regards,
Sudeep
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sudeep Holla Aug. 2, 2017, 5:45 p.m. UTC | #3
On 24/07/17 17:32, Sudeep Holla wrote:
> 

> 

> On 24/07/17 17:00, Rob Herring wrote:

>> On Mon, Jul 24, 2017 at 8:55 AM, Sudeep Holla <sudeep.holla@arm.com> wrote:

>>> Instead of the callsites choosing between of_cpu_device_node_get if the

>>> CPUs are registered as of_node is populated by then and of_get_cpu_node

>>> when the CPUs are not yet registered as CPU of_nodes are not yet stashed

>>> thereby needing to parse the device tree, we can call of_get_cpu_node

>>> in case the CPUs are not yet registered.

>>>

>>> This will allow to use of_cpu_device_node_get anywhere hiding the

>>> details from the caller.

>>>

>>> Cc: Rob Herring <robh+dt@kernel.org>

>>> Cc: Frank Rowand <frowand.list@gmail.com>

>>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

>>> ---

>>>  include/linux/of_device.h | 2 +-

>>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>>

>>> Hi Rob,

>>>

>>> Let me know if you are OK with this change. I keep seeing different

>>> drivers calling of_get_cpu_node or of_cpu_device_node_get based on what

>>> they are aware of or copying from other place without knowing the

>>> details. I am trying to avoid that and ask to use of_cpu_device_node_get

>>> at all places instead.

>>

>> Seems fine to me.

>>

>> Acked-by: Rob Herring <robh@kernel.org>

>>

> 

> Thanks. Can you take it through your tree itself ? I can make any follow

> patches(if any) once this lands in the tree. I don't have any for now

> just to avoid all cross dependencies.

> 


Sorry for the nag. Please queue this for v4.14 via your DT tree itself.

-- 
Regards,
Sudeep
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring Aug. 21, 2017, 5:20 p.m. UTC | #4
On Mon, Jul 24, 2017 at 05:32:21PM +0100, Sudeep Holla wrote:
> 

> 

> On 24/07/17 17:00, Rob Herring wrote:

> > On Mon, Jul 24, 2017 at 8:55 AM, Sudeep Holla <sudeep.holla@arm.com> wrote:

> >> Instead of the callsites choosing between of_cpu_device_node_get if the

> >> CPUs are registered as of_node is populated by then and of_get_cpu_node

> >> when the CPUs are not yet registered as CPU of_nodes are not yet stashed

> >> thereby needing to parse the device tree, we can call of_get_cpu_node

> >> in case the CPUs are not yet registered.

> >>

> >> This will allow to use of_cpu_device_node_get anywhere hiding the

> >> details from the caller.

> >>

> >> Cc: Rob Herring <robh+dt@kernel.org>

> >> Cc: Frank Rowand <frowand.list@gmail.com>

> >> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

> >> ---

> >>  include/linux/of_device.h | 2 +-

> >>  1 file changed, 1 insertion(+), 1 deletion(-)

> >>

> >> Hi Rob,

> >>

> >> Let me know if you are OK with this change. I keep seeing different

> >> drivers calling of_get_cpu_node or of_cpu_device_node_get based on what

> >> they are aware of or copying from other place without knowing the

> >> details. I am trying to avoid that and ask to use of_cpu_device_node_get

> >> at all places instead.

> > 

> > Seems fine to me.

> > 

> > Acked-by: Rob Herring <robh@kernel.org>

> > 

> 

> Thanks. Can you take it through your tree itself ? I can make any follow

> patches(if any) once this lands in the tree. I don't have any for now

> just to avoid all cross dependencies.


Done.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index b4ad8b4f8506..611502524425 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -50,7 +50,7 @@  static inline struct device_node *of_cpu_device_node_get(int cpu)
 	struct device *cpu_dev;
 	cpu_dev = get_cpu_device(cpu);
 	if (!cpu_dev)
-		return NULL;
+		return of_get_cpu_node(cpu, NULL);
 	return of_node_get(cpu_dev->of_node);
 }