summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/acpi.c
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2016-04-25 12:25:11 +0200
committerWill Deacon <will.deacon@arm.com>2016-04-25 14:54:15 +0200
commit9981293fb0f02e6127d6ab00218bf091f9f6c89b (patch)
tree989fb4cccf131cf22c84ff34c0dd2b386e923f41 /arch/arm64/kernel/acpi.c
parentARM64: ACPI: Check if it runs on Xen to enable or disable ACPI (diff)
downloadlinux-9981293fb0f02e6127d6ab00218bf091f9f6c89b.tar.xz
linux-9981293fb0f02e6127d6ab00218bf091f9f6c89b.zip
arm64: make dt_scan_depth1_nodes more readable
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> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/acpi.c')
-rw-r--r--arch/arm64/kernel/acpi.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 57ee31745af5..6884c7678453 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;
}
/*