Commit b6363fe7 authored by Rob Herring's avatar Rob Herring Committed by Catalin Marinas

arm64: Simplify checking for populated DT

Use of the of_scan_flat_dt() function predates libfdt and is discouraged
as libfdt provides a nicer set of APIs. Rework dt_scan_depth1_nodes to
use libfdt calls directly, and rename it to dt_is_stub() to reflect
exactly what it checking.

Cc: Will Deacon <will@kernel.org>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20211029144055.2365814-1-robh@kernel.orgSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent d658220a
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/irq_work.h> #include <linux/irq_work.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <linux/libfdt.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/pgtable.h> #include <linux/pgtable.h>
...@@ -62,29 +63,22 @@ static int __init parse_acpi(char *arg) ...@@ -62,29 +63,22 @@ static int __init parse_acpi(char *arg)
} }
early_param("acpi", parse_acpi); early_param("acpi", parse_acpi);
static int __init dt_scan_depth1_nodes(unsigned long node, static bool __init dt_is_stub(void)
const char *uname, int depth,
void *data)
{ {
/* int node;
* Ignore anything not directly under the root node; we'll
* catch its parent instead.
*/
if (depth != 1)
return 0;
if (strcmp(uname, "chosen") == 0) fdt_for_each_subnode(node, initial_boot_params, 0) {
return 0; const char *name = fdt_get_name(initial_boot_params, node, NULL);
if (strcmp(name, "chosen") == 0)
if (strcmp(uname, "hypervisor") == 0 && continue;
if (strcmp(name, "hypervisor") == 0 &&
of_flat_dt_is_compatible(node, "xen,xen")) of_flat_dt_is_compatible(node, "xen,xen"))
return 0; continue;
/* return false;
* This node at depth 1 is neither a chosen node nor a xen node, }
* which we do not expect.
*/ return true;
return 1;
} }
/* /*
...@@ -205,8 +199,7 @@ void __init acpi_boot_table_init(void) ...@@ -205,8 +199,7 @@ void __init acpi_boot_table_init(void)
* and ACPI has not been [force] enabled (acpi=on|force) * and ACPI has not been [force] enabled (acpi=on|force)
*/ */
if (param_acpi_off || if (param_acpi_off ||
(!param_acpi_on && !param_acpi_force && (!param_acpi_on && !param_acpi_force && !dt_is_stub()))
of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
goto done; goto done;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment