linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] make dt_scan_depth1_nodes more readable
Date: Mon, 25 Apr 2016 11:53:40 +0100	[thread overview]
Message-ID: <20160425105340.GE16065@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1604251121590.4855@sstabellini-ThinkPad-X260>

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;
>  }
>  
>  /*
> 

  reply	other threads:[~2016-04-25 10:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25 10:25 [PATCH] make dt_scan_depth1_nodes more readable Stefano Stabellini
2016-04-25 10:53 ` Will Deacon [this message]
2016-04-25 11:04   ` Stefano Stabellini
2016-04-25 11:19     ` Will Deacon
2016-04-25 11:24       ` Stefano Stabellini
2016-04-25 12:54         ` Will Deacon
2016-04-25 12:56           ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160425105340.GE16065@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).