* [PATCH -next] arm64: use for_each_node_by_type() macro
@ 2013-10-30 5:25 Wei Yongjun
2013-10-30 5:35 ` Rob Herring
0 siblings, 1 reply; 7+ messages in thread
From: Wei Yongjun @ 2013-10-30 5:25 UTC (permalink / raw)
To: linux-arm-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Use for_each_node_by_type() macro instead of open coding it.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
arch/arm64/kernel/cpu_ops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index aa0c9e7..37a4977 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -78,10 +78,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
void __init cpu_read_bootcpu_ops(void)
{
- struct device_node *dn = NULL;
+ struct device_node *dn;
u64 mpidr = cpu_logical_map(0);
- while ((dn = of_find_node_by_type(dn, "cpu"))) {
+ for_each_node_by_type(dn, "cpu") {
u64 hwid;
const __be32 *prop;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH -next] arm64: use for_each_node_by_type() macro
2013-10-30 5:25 [PATCH -next] arm64: use for_each_node_by_type() macro Wei Yongjun
@ 2013-10-30 5:35 ` Rob Herring
2013-10-30 5:54 ` [PATCH -next v2] " Wei Yongjun
0 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2013-10-30 5:35 UTC (permalink / raw)
To: linux-arm-kernel
On 10/30/2013 12:25 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Use for_each_node_by_type() macro instead of open coding it.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> arch/arm64/kernel/cpu_ops.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
> index aa0c9e7..37a4977 100644
> --- a/arch/arm64/kernel/cpu_ops.c
> +++ b/arch/arm64/kernel/cpu_ops.c
> @@ -78,10 +78,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
>
> void __init cpu_read_bootcpu_ops(void)
> {
> - struct device_node *dn = NULL;
> + struct device_node *dn;
> u64 mpidr = cpu_logical_map(0);
>
> - while ((dn = of_find_node_by_type(dn, "cpu"))) {
> + for_each_node_by_type(dn, "cpu") {
^
Extra space here.
> u64 hwid;
> const __be32 *prop;
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -next v2] arm64: use for_each_node_by_type() macro
2013-10-30 5:35 ` Rob Herring
@ 2013-10-30 5:54 ` Wei Yongjun
2013-10-30 10:54 ` Catalin Marinas
2013-10-30 11:49 ` Sudeep KarkadaNagesha
0 siblings, 2 replies; 7+ messages in thread
From: Wei Yongjun @ 2013-10-30 5:54 UTC (permalink / raw)
To: linux-arm-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Use for_each_node_by_type() macro instead of open coding it.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
v1 -> v2: remove extra space
---
arch/arm64/kernel/cpu_ops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index aa0c9e7..37a4977 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -78,10 +78,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
void __init cpu_read_bootcpu_ops(void)
{
- struct device_node *dn = NULL;
+ struct device_node *dn;
u64 mpidr = cpu_logical_map(0);
- while ((dn = of_find_node_by_type(dn, "cpu"))) {
+ for_each_node_by_type(dn, "cpu") {
u64 hwid;
const __be32 *prop;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH -next v2] arm64: use for_each_node_by_type() macro
2013-10-30 5:54 ` [PATCH -next v2] " Wei Yongjun
@ 2013-10-30 10:54 ` Catalin Marinas
2013-10-30 11:49 ` Sudeep KarkadaNagesha
1 sibling, 0 replies; 7+ messages in thread
From: Catalin Marinas @ 2013-10-30 10:54 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Oct 30, 2013 at 05:54:41AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Use for_each_node_by_type() macro instead of open coding it.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Applied. Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -next v2] arm64: use for_each_node_by_type() macro
2013-10-30 5:54 ` [PATCH -next v2] " Wei Yongjun
2013-10-30 10:54 ` Catalin Marinas
@ 2013-10-30 11:49 ` Sudeep KarkadaNagesha
2013-10-30 12:16 ` Catalin Marinas
1 sibling, 1 reply; 7+ messages in thread
From: Sudeep KarkadaNagesha @ 2013-10-30 11:49 UTC (permalink / raw)
To: linux-arm-kernel
On 30/10/13 05:54, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Use for_each_node_by_type() macro instead of open coding it.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> v1 -> v2: remove extra space
> ---
> arch/arm64/kernel/cpu_ops.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
> index aa0c9e7..37a4977 100644
> --- a/arch/arm64/kernel/cpu_ops.c
> +++ b/arch/arm64/kernel/cpu_ops.c
> @@ -78,10 +78,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
>
> void __init cpu_read_bootcpu_ops(void)
> {
> - struct device_node *dn = NULL;
> + struct device_node *dn;
> u64 mpidr = cpu_logical_map(0);
>
> - while ((dn = of_find_node_by_type(dn, "cpu"))) {
> + for_each_node_by_type(dn, "cpu") {
> u64 hwid;
> const __be32 *prop;
>
In fact this function can be simplified by making use of OF helper directly,
something like below snippet. But it requires [1] for correct functionality.
Regards,
Sudeep
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/206401.html
-->8
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index de78d22..f297a18 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -73,22 +73,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
void __init cpu_read_bootcpu_ops(void)
{
- struct device_node *dn = NULL;
- u64 mpidr = cpu_logical_map(0);
-
- while ((dn = of_find_node_by_type(dn, "cpu"))) {
- u64 hwid;
- const __be32 *prop;
-
- prop = of_get_property(dn, "reg", NULL);
- if (!prop)
- continue;
-
- hwid = of_read_number(prop, of_n_addr_cells(dn));
- if (hwid == mpidr) {
- cpu_read_ops(dn, 0);
- of_node_put(dn);
- return;
- }
+ struct device_node *dn = of_get_cpu_node(0, NULL);
+ if (!dn) {
+ pr_err("failed to find device node for boot cpu\n");
+ return;
}
+ cpu_read_ops(dn, 0);
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH -next v2] arm64: use for_each_node_by_type() macro
2013-10-30 11:49 ` Sudeep KarkadaNagesha
@ 2013-10-30 12:16 ` Catalin Marinas
2013-10-30 14:22 ` Sudeep KarkadaNagesha
0 siblings, 1 reply; 7+ messages in thread
From: Catalin Marinas @ 2013-10-30 12:16 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Oct 30, 2013 at 11:49:12AM +0000, Sudeep KarkadaNagesha wrote:
> On 30/10/13 05:54, Wei Yongjun wrote:
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> >
> > Use for_each_node_by_type() macro instead of open coding it.
> >
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > ---
> > v1 -> v2: remove extra space
> > ---
> > arch/arm64/kernel/cpu_ops.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
> > index aa0c9e7..37a4977 100644
> > --- a/arch/arm64/kernel/cpu_ops.c
> > +++ b/arch/arm64/kernel/cpu_ops.c
> > @@ -78,10 +78,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
> >
> > void __init cpu_read_bootcpu_ops(void)
> > {
> > - struct device_node *dn = NULL;
> > + struct device_node *dn;
> > u64 mpidr = cpu_logical_map(0);
> >
> > - while ((dn = of_find_node_by_type(dn, "cpu"))) {
> > + for_each_node_by_type(dn, "cpu") {
> > u64 hwid;
> > const __be32 *prop;
> >
>
> In fact this function can be simplified by making use of OF helper directly,
> something like below snippet. But it requires [1] for correct functionality.
Thanks. Could you please send a properly formatted patch on top of [1]?
--
Catalin
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -next v2] arm64: use for_each_node_by_type() macro
2013-10-30 12:16 ` Catalin Marinas
@ 2013-10-30 14:22 ` Sudeep KarkadaNagesha
0 siblings, 0 replies; 7+ messages in thread
From: Sudeep KarkadaNagesha @ 2013-10-30 14:22 UTC (permalink / raw)
To: linux-arm-kernel
On 30/10/13 12:16, Catalin Marinas wrote:
> On Wed, Oct 30, 2013 at 11:49:12AM +0000, Sudeep KarkadaNagesha wrote:
>> On 30/10/13 05:54, Wei Yongjun wrote:
>>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>>
>>> Use for_each_node_by_type() macro instead of open coding it.
>>>
>>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>> ---
>>> v1 -> v2: remove extra space
>>> ---
>>> arch/arm64/kernel/cpu_ops.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
>>> index aa0c9e7..37a4977 100644
>>> --- a/arch/arm64/kernel/cpu_ops.c
>>> +++ b/arch/arm64/kernel/cpu_ops.c
>>> @@ -78,10 +78,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu)
>>>
>>> void __init cpu_read_bootcpu_ops(void)
>>> {
>>> - struct device_node *dn = NULL;
>>> + struct device_node *dn;
>>> u64 mpidr = cpu_logical_map(0);
>>>
>>> - while ((dn = of_find_node_by_type(dn, "cpu"))) {
>>> + for_each_node_by_type(dn, "cpu") {
>>> u64 hwid;
>>> const __be32 *prop;
>>>
>>
>> In fact this function can be simplified by making use of OF helper directly,
>> something like below snippet. But it requires [1] for correct functionality.
>
> Thanks. Could you please send a properly formatted patch on top of [1]?
Yes it's done [2]
Regards,
Sudeep
[2] http://www.spinics.net/lists/arm-kernel/msg283243.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-10-30 14:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-30 5:25 [PATCH -next] arm64: use for_each_node_by_type() macro Wei Yongjun
2013-10-30 5:35 ` Rob Herring
2013-10-30 5:54 ` [PATCH -next v2] " Wei Yongjun
2013-10-30 10:54 ` Catalin Marinas
2013-10-30 11:49 ` Sudeep KarkadaNagesha
2013-10-30 12:16 ` Catalin Marinas
2013-10-30 14:22 ` Sudeep KarkadaNagesha
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).