Skip to content

Commit

Permalink
arm64: make dt_scan_depth1_nodes more readable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Rutland authored and Will Deacon committed Apr 25, 2016
1 parent 2366c7f commit 9981293
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions arch/arm64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down

0 comments on commit 9981293

Please sign in to comment.