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 X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C82D8C433E2 for ; Sat, 12 Sep 2020 12:53:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 7DB182073E for ; Sat, 12 Sep 2020 12:53:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="U87MuwIR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="igDqGf8j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DB182073E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+HOp8FhMbTp6RuBNV4+0T2MjP0EsXnkXVpVzVFsEZcc=; b=U87MuwIRnmLXSkM25kMFTiraL KT1Dndj8PHeskjmwrw/1Ei6lwRO1OpETQcQ+E8zAG+JijPbHQuv//T1u4bR8w6C10c9vAgT20nimI JWARGjAI9lpP72ZsQMGb27wpOudVT6WQmIziEqtMi8JQBfrJeHtbqSFctdWcXPIbU+52frKjkt8gk O3ZKRHFRjOCBZQcx+uB0DKDziFauo5VOsozyIWLZuDrotOL85phkJrKPVr+035wRWfJO4hi5Pw2ly 0m0pshny+1STp7vJXG/V4JejvdPgonTx1xjYoWGQpHI56+CFFWkjD3q9T7MkBXZVAeR2zk6WQkVji 1XzpFPLCQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH50w-0004pj-Kb; Sat, 12 Sep 2020 12:52:22 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH50i-0004mL-Vh for linux-arm-kernel@lists.infradead.org; Sat, 12 Sep 2020 12:52:11 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7EDE621548; Sat, 12 Sep 2020 12:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599915126; bh=hdZxjd6wROF46ulEXaL1r8Qh7vy+67B2mL/4PqcChOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igDqGf8jouaI91hLmQoIws6wPC1jVdF9RTHtagkc0NXp4oPeY5KA1vSZiCCAg8bKU jTiaXqWApkfSgYM8Lz0taQYe0r7eMqE2fCp60TygTdb8KaenIq/y8J1HVzap1D3lgr zrR3HSUnjpls+pk7UvQ1Ficg0eUZptrVihzsMRV8= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kH50f-00BEw6-1g; Sat, 12 Sep 2020 13:52:05 +0100 From: Marc Zyngier To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/6] of: Add basic infrastructure to create early probe arrays Date: Sat, 12 Sep 2020 13:51:43 +0100 Message-Id: <20200912125148.1271481-2-maz@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200912125148.1271481-1-maz@kernel.org> References: <20200912125148.1271481-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, enric.balletbo@collabora.com, linux@fw-web.de, john.stultz@linaro.org, saravanak@google.com, hanks.chen@mediatek.com, agross@kernel.org, bjorn.andersson@linaro.org, matthias.bgg@gmail.com, tglx@linutronix.de, jason@lakedaemon.net, robh+dt@kernel.org, frowand.list@gmail.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200912_085209_180052_034DE214 X-CRM114-Status: GOOD ( 15.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Cooper , Saravana Kannan , kernel-team@android.com, Hanks Chen , Rob Herring , Bjorn Andersson , Matthias Brugger , Andy Gross , John Stultz , Enric Balletbo i Serra , Frank Wunderlich , Frank Rowand , Thomas Gleixner 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 We currently probe interrupt controller and timers that need to be available very early using an infratstructure that creates struct of_device_id instances in a special section. These are individual structures that are ultimately collated by the linker. In order to facilitate further use of this infrastructure for drivers that can either be built modular or as an early driver, let's add a couple of helpers that will make it look like a "normal" device_id array, like this: _OF_DECLARE_ARRAY_START(table, name) _OF_DECLARE_ELMT("compat-1", probe, type) _OF_DECLARE_ELMT("compat-2", probe, type) _OF_DECLARE_ELMT("compat-3", other_probe, type) _OF_DECLARE_ARRAY_END Signed-off-by: Marc Zyngier --- include/linux/of.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/of.h b/include/linux/of.h index 5cf7ae0465d1..08f78da95378 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1291,20 +1291,35 @@ static inline int of_get_available_child_count(const struct device_node *np) return num; } +#define __OF_DECLARE_ARRAY_START(name, section) \ + static const struct of_device_id __of_table_##name[] \ + __used __section(section) = { + #if defined(CONFIG_OF) && !defined(MODULE) #define _OF_DECLARE(table, name, compat, fn, fn_type) \ static const struct of_device_id __of_table_##name \ __used __section(__##table##_of_table) \ = { .compatible = compat, \ .data = (fn == (fn_type)NULL) ? fn : fn } +#define _OF_DECLARE_ARRAY_START(table, name) \ + __OF_DECLARE_ARRAY_START(name, __##table##_of_table) #else #define _OF_DECLARE(table, name, compat, fn, fn_type) \ static const struct of_device_id __of_table_##name \ __attribute__((unused)) \ = { .compatible = compat, \ .data = (fn == (fn_type)NULL) ? fn : fn } +#define _OF_DECLARE_ARRAY_START(table, name) \ + __OF_DECLARE_ARRAY_START(name, unused) #endif +#define _OF_DECLARE_ARRAY_END } +#define _OF_DECLARE_ELMT(compat, fn, fn_type) \ + { \ + .compatible = compat, \ + .data = (fn == (fn_type)NULL) ? fn : fn, \ + }, + typedef int (*of_init_fn_2)(struct device_node *, struct device_node *); typedef int (*of_init_fn_1_ret)(struct device_node *); typedef void (*of_init_fn_1)(struct device_node *); -- 2.28.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel