All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: linux-arm-kernel@lists.infradead.org
Cc: sstabellini@kernel.org, mark.rutland@arm.com,
	catalin.marinas@arm.com, will.deacon@arm.com,
	shannon.zhao@linaro.org, linux-kernel@vger.kernel.org,
	peter.huangpeng@huawei.com
Subject: [PATCH] make dt_scan_depth1_nodes more readable
Date: Mon, 25 Apr 2016 11:25:11 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1604251121590.4855@sstabellini-ThinkPad-X260> (raw)

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

WARNING: multiple messages have this Message-ID (diff)
From: sstabellini@kernel.org (Stefano Stabellini)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] make dt_scan_depth1_nodes more readable
Date: Mon, 25 Apr 2016 11:25:11 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1604251121590.4855@sstabellini-ThinkPad-X260> (raw)

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

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

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25 10:25 Stefano Stabellini [this message]
2016-04-25 10:25 ` [PATCH] make dt_scan_depth1_nodes more readable Stefano Stabellini
2016-04-25 10:53 ` Will Deacon
2016-04-25 10:53   ` Will Deacon
2016-04-25 11:04   ` Stefano Stabellini
2016-04-25 11:04     ` Stefano Stabellini
2016-04-25 11:19     ` Will Deacon
2016-04-25 11:19       ` Will Deacon
2016-04-25 11:24       ` Stefano Stabellini
2016-04-25 11:24         ` Stefano Stabellini
2016-04-25 12:54         ` Will Deacon
2016-04-25 12:54           ` Will Deacon
2016-04-25 12:56           ` Stefano Stabellini
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=alpine.DEB.2.10.1604251121590.4855@sstabellini-ThinkPad-X260 \
    --to=sstabellini@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=shannon.zhao@linaro.org \
    --cc=will.deacon@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.