Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1386219 > unrolled thread

[PATCH] make dt_scan_depth1_nodes more readable

Started byStefano Stabellini <sstabellini@kernel.org>
First post2016-04-25 12:30 +0200
Last post2016-04-25 15:00 +0200
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] make dt_scan_depth1_nodes more readable Stefano Stabellini <sstabellini@kernel.org> - 2016-04-25 12:30 +0200
    Re: [PATCH] make dt_scan_depth1_nodes more readable Will Deacon <will.deacon@arm.com> - 2016-04-25 13:00 +0200
      Re: [PATCH] make dt_scan_depth1_nodes more readable Stefano Stabellini <sstabellini@kernel.org> - 2016-04-25 13:10 +0200
        Re: [PATCH] make dt_scan_depth1_nodes more readable Will Deacon <will.deacon@arm.com> - 2016-04-25 13:20 +0200
          Re: [PATCH] make dt_scan_depth1_nodes more readable Stefano Stabellini <sstabellini@kernel.org> - 2016-04-25 13:30 +0200
            Re: [PATCH] make dt_scan_depth1_nodes more readable Will Deacon <will.deacon@arm.com> - 2016-04-25 15:00 +0200
              Re: [PATCH] make dt_scan_depth1_nodes more readable Stefano Stabellini <sstabellini@kernel.org> - 2016-04-25 15:00 +0200

#1386219 — [PATCH] make dt_scan_depth1_nodes more readable

FromStefano Stabellini <sstabellini@kernel.org>
Date2016-04-25 12:30 +0200
Subject[PATCH] make dt_scan_depth1_nodes more readable
Message-ID<rrLWb-46w-49@gated-at.bofh.it>
From: Mark Rutland <mark.rutland@arm.com>

Improve the readability of dt_scan_depth1_nodes by removing the nested
conditionals.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>

---

Note: this patch is based on xentip/for-linus-4.7

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 57ee317..6884c76 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -66,17 +66,24 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
 				       void *data)
 {
 	/*
-	 * Return 1 as soon as we encounter a node at depth 1 that is
-	 * not the /chosen node, or /hypervisor node with compatible
-	 * string "xen,xen".
+	 * Ignore anything not directly under the root node; we'll
+	 * catch its parent instead.
 	 */
-	if (depth == 1 && (strcmp(uname, "chosen") != 0)) {
-		if (strcmp(uname, "hypervisor") != 0 ||
-		    !of_flat_dt_is_compatible(node, "xen,xen"))
-			return 1;
-	}
+	if (depth != 1)
+		return 0;
 
-	return 0;
+	if (strcmp(uname, "chosen") == 0)
+		return 0;
+
+	if (strcmp(uname, "hypervisor") == 0 &&
+	    of_flat_dt_is_compatible(node, "xen,xen"))
+		return 0;
+
+	/*
+	 * This node at depth 1 is neither a chosen node nor a xen node,
+	 * which we do not expect.
+	 */
+	return 1;
 }
 
 /*

[toc] | [next] | [standalone]


#1386237

FromWill Deacon <will.deacon@arm.com>
Date2016-04-25 13:00 +0200
Message-ID<rrMpc-4ls-9@gated-at.bofh.it>
In reply to#1386219
On Mon, Apr 25, 2016 at 11:25:11AM +0100, Stefano Stabellini wrote:
> From: Mark Rutland <mark.rutland@arm.com>
> 
> Improve the readability of dt_scan_depth1_nodes by removing the nested
> conditionals.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> ---
> 
> Note: this patch is based on xentip/for-linus-4.7

So how should I merge it? :/

Will

> 
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index 57ee317..6884c76 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -66,17 +66,24 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
>  				       void *data)
>  {
>  	/*
> -	 * Return 1 as soon as we encounter a node at depth 1 that is
> -	 * not the /chosen node, or /hypervisor node with compatible
> -	 * string "xen,xen".
> +	 * Ignore anything not directly under the root node; we'll
> +	 * catch its parent instead.
>  	 */
> -	if (depth == 1 && (strcmp(uname, "chosen") != 0)) {
> -		if (strcmp(uname, "hypervisor") != 0 ||
> -		    !of_flat_dt_is_compatible(node, "xen,xen"))
> -			return 1;
> -	}
> +	if (depth != 1)
> +		return 0;
>  
> -	return 0;
> +	if (strcmp(uname, "chosen") == 0)
> +		return 0;
> +
> +	if (strcmp(uname, "hypervisor") == 0 &&
> +	    of_flat_dt_is_compatible(node, "xen,xen"))
> +		return 0;
> +
> +	/*
> +	 * This node at depth 1 is neither a chosen node nor a xen node,
> +	 * which we do not expect.
> +	 */
> +	return 1;
>  }
>  
>  /*
> 

[toc] | [prev] | [next] | [standalone]


#1386253

FromStefano Stabellini <sstabellini@kernel.org>
Date2016-04-25 13:10 +0200
Message-ID<rrMyR-4Ln-5@gated-at.bofh.it>
In reply to#1386237
On Mon, 25 Apr 2016, Will Deacon wrote:
> On Mon, Apr 25, 2016 at 11:25:11AM +0100, Stefano Stabellini wrote:
> > From: Mark Rutland <mark.rutland@arm.com>
> > 
> > Improve the readability of dt_scan_depth1_nodes by removing the nested
> > conditionals.
> > 
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > 
> > ---
> > 
> > Note: this patch is based on xentip/for-linus-4.7
> 
> So how should I merge it? :/

I think that if you would like to merge it, it would be easier this time
for me to carry it in my tree. Otherwise you would have to base your
for-linus-4.7 on xentip/for-linus-4.7 and send the pull request after
the Xen pull request -- undesirable.


> > 
> > diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> > index 57ee317..6884c76 100644
> > --- a/arch/arm64/kernel/acpi.c
> > +++ b/arch/arm64/kernel/acpi.c
> > @@ -66,17 +66,24 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
> >  				       void *data)
> >  {
> >  	/*
> > -	 * Return 1 as soon as we encounter a node at depth 1 that is
> > -	 * not the /chosen node, or /hypervisor node with compatible
> > -	 * string "xen,xen".
> > +	 * Ignore anything not directly under the root node; we'll
> > +	 * catch its parent instead.
> >  	 */
> > -	if (depth == 1 && (strcmp(uname, "chosen") != 0)) {
> > -		if (strcmp(uname, "hypervisor") != 0 ||
> > -		    !of_flat_dt_is_compatible(node, "xen,xen"))
> > -			return 1;
> > -	}
> > +	if (depth != 1)
> > +		return 0;
> >  
> > -	return 0;
> > +	if (strcmp(uname, "chosen") == 0)
> > +		return 0;
> > +
> > +	if (strcmp(uname, "hypervisor") == 0 &&
> > +	    of_flat_dt_is_compatible(node, "xen,xen"))
> > +		return 0;
> > +
> > +	/*
> > +	 * This node at depth 1 is neither a chosen node nor a xen node,
> > +	 * which we do not expect.
> > +	 */
> > +	return 1;
> >  }
> >  
> >  /*
> > 
> 

[toc] | [prev] | [next] | [standalone]


#1386266

FromWill Deacon <will.deacon@arm.com>
Date2016-04-25 13:20 +0200
Message-ID<rrMIy-4QJ-21@gated-at.bofh.it>
In reply to#1386253
On Mon, Apr 25, 2016 at 12:04:53PM +0100, Stefano Stabellini wrote:
> On Mon, 25 Apr 2016, Will Deacon wrote:
> > On Mon, Apr 25, 2016 at 11:25:11AM +0100, Stefano Stabellini wrote:
> > > From: Mark Rutland <mark.rutland@arm.com>
> > > 
> > > Improve the readability of dt_scan_depth1_nodes by removing the nested
> > > conditionals.
> > > 
> > > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > > 
> > > ---
> > > 
> > > Note: this patch is based on xentip/for-linus-4.7
> > 
> > So how should I merge it? :/
> 
> I think that if you would like to merge it, it would be easier this time
> for me to carry it in my tree. Otherwise you would have to base your
> for-linus-4.7 on xentip/for-linus-4.7 and send the pull request after
> the Xen pull request -- undesirable.

Ok, doesn't look like we'll run into conflicts. I just find it weird that
you'd have a patch with no functional change as a dependency, hence my
preference to queue it in the arm64 tree (where conflicts are more likely).

Will

[toc] | [prev] | [next] | [standalone]


#1386278

FromStefano Stabellini <sstabellini@kernel.org>
Date2016-04-25 13:30 +0200
Message-ID<rrMSf-4Wa-37@gated-at.bofh.it>
In reply to#1386266
On Mon, 25 Apr 2016, Will Deacon wrote:
> On Mon, Apr 25, 2016 at 12:04:53PM +0100, Stefano Stabellini wrote:
> > On Mon, 25 Apr 2016, Will Deacon wrote:
> > > On Mon, Apr 25, 2016 at 11:25:11AM +0100, Stefano Stabellini wrote:
> > > > From: Mark Rutland <mark.rutland@arm.com>
> > > > 
> > > > Improve the readability of dt_scan_depth1_nodes by removing the nested
> > > > conditionals.
> > > > 
> > > > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > > > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > > > 
> > > > ---
> > > > 
> > > > Note: this patch is based on xentip/for-linus-4.7
> > > 
> > > So how should I merge it? :/
> > 
> > I think that if you would like to merge it, it would be easier this time
> > for me to carry it in my tree. Otherwise you would have to base your
> > for-linus-4.7 on xentip/for-linus-4.7 and send the pull request after
> > the Xen pull request -- undesirable.
> 
> Ok, doesn't look like we'll run into conflicts. I just find it weird that
> you'd have a patch with no functional change as a dependency, hence my
> preference to queue it in the arm64 tree (where conflicts are more likely).
 
I see, that makes sense. In that case, would you be happy to take:

https://git.kernel.org/cgit/linux/kernel/git/xen/tip.git/commit/?h=for-linus-4.7&id=df115bb0a0b8ad2f6dc62f8d094c21e77b367e7c

in your tree? That would get rid of any cross dependecies between the
two tree.

[toc] | [prev] | [next] | [standalone]


#1386385

FromWill Deacon <will.deacon@arm.com>
Date2016-04-25 15:00 +0200
Message-ID<rrOhk-643-3@gated-at.bofh.it>
In reply to#1386278
On Mon, Apr 25, 2016 at 12:24:03PM +0100, Stefano Stabellini wrote:
> On Mon, 25 Apr 2016, Will Deacon wrote:
> > On Mon, Apr 25, 2016 at 12:04:53PM +0100, Stefano Stabellini wrote:
> > > On Mon, 25 Apr 2016, Will Deacon wrote:
> > > > On Mon, Apr 25, 2016 at 11:25:11AM +0100, Stefano Stabellini wrote:
> > > > > From: Mark Rutland <mark.rutland@arm.com>
> > > > > 
> > > > > Improve the readability of dt_scan_depth1_nodes by removing the nested
> > > > > conditionals.
> > > > > 
> > > > > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > > > > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > > > > 
> > > > > ---
> > > > > 
> > > > > Note: this patch is based on xentip/for-linus-4.7
> > > > 
> > > > So how should I merge it? :/
> > > 
> > > I think that if you would like to merge it, it would be easier this time
> > > for me to carry it in my tree. Otherwise you would have to base your
> > > for-linus-4.7 on xentip/for-linus-4.7 and send the pull request after
> > > the Xen pull request -- undesirable.
> > 
> > Ok, doesn't look like we'll run into conflicts. I just find it weird that
> > you'd have a patch with no functional change as a dependency, hence my
> > preference to queue it in the arm64 tree (where conflicts are more likely).
>  
> I see, that makes sense. In that case, would you be happy to take:
> 
> https://git.kernel.org/cgit/linux/kernel/git/xen/tip.git/commit/?h=for-linus-4.7&id=df115bb0a0b8ad2f6dc62f8d094c21e77b367e7c
> 
> in your tree? That would get rid of any cross dependecies between the
> two tree.

I can take that and the other patch on top too.

Will

[toc] | [prev] | [next] | [standalone]


#1386392

FromStefano Stabellini <sstabellini@kernel.org>
Date2016-04-25 15:00 +0200
Message-ID<rrOhm-643-27@gated-at.bofh.it>
In reply to#1386385
On Mon, 25 Apr 2016, Will Deacon wrote:
> On Mon, Apr 25, 2016 at 12:24:03PM +0100, Stefano Stabellini wrote:
> > On Mon, 25 Apr 2016, Will Deacon wrote:
> > > On Mon, Apr 25, 2016 at 12:04:53PM +0100, Stefano Stabellini wrote:
> > > > On Mon, 25 Apr 2016, Will Deacon wrote:
> > > > > On Mon, Apr 25, 2016 at 11:25:11AM +0100, Stefano Stabellini wrote:
> > > > > > From: Mark Rutland <mark.rutland@arm.com>
> > > > > > 
> > > > > > Improve the readability of dt_scan_depth1_nodes by removing the nested
> > > > > > conditionals.
> > > > > > 
> > > > > > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > > > > > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > > > > > 
> > > > > > ---
> > > > > > 
> > > > > > Note: this patch is based on xentip/for-linus-4.7
> > > > > 
> > > > > So how should I merge it? :/
> > > > 
> > > > I think that if you would like to merge it, it would be easier this time
> > > > for me to carry it in my tree. Otherwise you would have to base your
> > > > for-linus-4.7 on xentip/for-linus-4.7 and send the pull request after
> > > > the Xen pull request -- undesirable.
> > > 
> > > Ok, doesn't look like we'll run into conflicts. I just find it weird that
> > > you'd have a patch with no functional change as a dependency, hence my
> > > preference to queue it in the arm64 tree (where conflicts are more likely).
> >  
> > I see, that makes sense. In that case, would you be happy to take:
> > 
> > https://git.kernel.org/cgit/linux/kernel/git/xen/tip.git/commit/?h=for-linus-4.7&id=df115bb0a0b8ad2f6dc62f8d094c21e77b367e7c
> > 
> > in your tree? That would get rid of any cross dependecies between the
> > two tree.
> 
> I can take that and the other patch on top too.

Perfect. I'll remove df115bb0a0b8ad2f6dc62f8d094c21e77b367e7c from xentip/for-linus-4.7.

Thanks,

Stefano

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web