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


Groups > linux.kernel > #1386219

[PATCH] make dt_scan_depth1_nodes more readable

From Stefano Stabellini <sstabellini@kernel.org>
Newsgroups linux.kernel
Subject [PATCH] make dt_scan_depth1_nodes more readable
Date 2016-04-25 12:30 +0200
Message-ID <rrLWb-46w-49@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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;
 }
 
 /*

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[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

csiph-web