From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED7B9C433FE for ; Thu, 28 Oct 2021 18:35:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD78B60D43 for ; Thu, 28 Oct 2021 18:35:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BD78B60D43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=oLTfnUygfJG2yETuKluEuMENL8T90ZPPUOaxS9x/Jz0=; b=r4kp8vuwyFdUie jlExhH0/rlZzq7dj/b3qObGsyfUL+rujx6WmM6yx04rtFiuzPB5YfYvoIiKXOqRH5PTt+pBxKX0wb PdMwm7g8tDMbL5X6hTp/ccA+ZfjhdfLsgknm8hrtDZIA/O0UOAiIXwn7uBbp++2Vp/CEPNv+Qfex2 Ps/HQveCr9LYbDEDTvuOBwTMUXQctOIH8nBmsRgy31HTY2CQhZjqIHwcauCDu+j4HdYZb2waAHCRF teOupapvq3oZMCX3WSZ3PfAyjmN7iDjvNcmGoE4JpPBdem0dDTHMQ3oYO6V6dos8vHMRdKnMN0Izs 8INknaS0G0iojEKNc5Fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgAE3-008s6G-4R; Thu, 28 Oct 2021 18:34:07 +0000 Received: from mail-oi1-f182.google.com ([209.85.167.182]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgADz-008s5s-EQ for linux-arm-kernel@lists.infradead.org; Thu, 28 Oct 2021 18:34:04 +0000 Received: by mail-oi1-f182.google.com with SMTP id x8so5280420oix.2 for ; Thu, 28 Oct 2021 11:33:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zHge/Nt+V6oXveriOkSfhWR7KvdNkPR1xSjU4Jlztjw=; b=cruc3HL47SinBeT4U6QV8CN4ll0aQvA0wntM6fAt4sbvWAQ37xH80pqro6jJ/Llf8/ /yMcentMmbe7c4G6tddhwFDFSft5nCihwpVKGmXiKtKnkQdrWmOW68GB34nFkLWR5euD 3v2p0twfUJoEV9Z82Yekksq3QNcuzpzAmGgBkcXFFdiqv5DawX5oeF1EgR0PifwELAiV 91MOMBDOVVSD5LiCgV1GWWLLMynW4aMcWXf7MSISDVALZNKyCmuSF4RT0WEqPIYeCGgm A+Ce+OTY4ncLB+K9ihSK9h0iynIQkCCPexfBF3nJDc9adrOlmAIkEcaog7qpxQbEThak 0JmQ== X-Gm-Message-State: AOAM531FEjSaqXDVYCB/IDWksUwbOIwEpA7CIv9YfOq8I8BkTV9y+nY8 PUhVEWw+1FLkT8zcBekEug== X-Google-Smtp-Source: ABdhPJwf+xRWyEEF31Uzxg58vZVWanelIjwzEv/7AK60ArEDHdpK8ZNq3CI8ChUthu0UH4HTvhKVqA== X-Received: by 2002:a05:6808:5c5:: with SMTP id d5mr3844977oij.173.1635446036644; Thu, 28 Oct 2021 11:33:56 -0700 (PDT) Received: from xps15.herring.priv (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.googlemail.com with ESMTPSA id f14sm1299033ots.51.2021.10.28.11.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 11:33:55 -0700 (PDT) From: Rob Herring To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Mark Rutland Subject: [PATCH] arm64: Simplify checking for populated DT Date: Thu, 28 Oct 2021 13:33:55 -0500 Message-Id: <20211028183355.360731-1-robh@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_113403_525362_4AA2856C X-CRM114-Status: GOOD ( 14.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use of 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. Rather than searching for any node not /chosen or /hypervisor, let's just check for something always required which is the arch timer. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Rob Herring --- arch/arm64/kernel/acpi.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index 1c9c2f7a1c04..f1bb0fb4a604 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -62,29 +63,12 @@ static int __init parse_acpi(char *arg) } early_param("acpi", parse_acpi); -static int __init dt_scan_depth1_nodes(unsigned long node, - const char *uname, int depth, - void *data) +static bool __init dt_is_populated(void) { - /* - * Ignore anything not directly under the root node; we'll - * catch its parent instead. - */ - if (depth != 1) - return 0; - - if (strcmp(uname, "chosen") == 0) - return 0; + const void *fdt = initial_boot_params; + int node = fdt_node_offset_by_compatible(fdt, -1, "arm,armv8-timer"); - 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; + return node > 0 ? true : false; } /* @@ -205,8 +189,7 @@ void __init acpi_boot_table_init(void) * and ACPI has not been [force] enabled (acpi=on|force) */ if (param_acpi_off || - (!param_acpi_on && !param_acpi_force && - of_scan_flat_dt(dt_scan_depth1_nodes, NULL))) + (!param_acpi_on && !param_acpi_force && dt_is_populated())) goto done; /* -- 2.32.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel