Skip to content

Commit 9981293

Browse files
mrutland-armwildea01
authored andcommitted
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>
1 parent 2366c7f commit 9981293

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

arch/arm64/kernel/acpi.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,24 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
6666
void *data)
6767
{
6868
/*
69-
* Return 1 as soon as we encounter a node at depth 1 that is
70-
* not the /chosen node, or /hypervisor node with compatible
71-
* string "xen,xen".
69+
* Ignore anything not directly under the root node; we'll
70+
* catch its parent instead.
7271
*/
73-
if (depth == 1 && (strcmp(uname, "chosen") != 0)) {
74-
if (strcmp(uname, "hypervisor") != 0 ||
75-
!of_flat_dt_is_compatible(node, "xen,xen"))
76-
return 1;
77-
}
72+
if (depth != 1)
73+
return 0;
7874

79-
return 0;
75+
if (strcmp(uname, "chosen") == 0)
76+
return 0;
77+
78+
if (strcmp(uname, "hypervisor") == 0 &&
79+
of_flat_dt_is_compatible(node, "xen,xen"))
80+
return 0;
81+
82+
/*
83+
* This node at depth 1 is neither a chosen node nor a xen node,
84+
* which we do not expect.
85+
*/
86+
return 1;
8087
}
8188

8289
/*

0 commit comments

Comments
 (0)