From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Marc Zyngier <maz@kernel.org>
Cc: devicetree@vger.kernel.org, Jason Cooper <jason@lakedaemon.net>,
Saravana Kannan <saravanak@google.com>,
kernel-team@android.com, Hanks Chen <hanks.chen@mediatek.com>,
linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Andy Gross <agross@kernel.org>,
John Stultz <john.stultz@linaro.org>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Frank Wunderlich <linux@fw-web.de>,
Frank Rowand <frowand.list@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/6] of: Add basic infrastructure to create early probe arrays
Date: Sat, 12 Sep 2020 18:20:22 -0500 [thread overview]
Message-ID: <20200912232022.GE3715@yoga> (raw)
In-Reply-To: <20200912125148.1271481-2-maz@kernel.org>
On Sat 12 Sep 07:51 CDT 2020, Marc Zyngier wrote:
> 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
>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
> 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
next prev parent reply other threads:[~2020-09-12 23:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-12 12:51 [PATCH 0/6] irqchip: Hybrid probing Marc Zyngier
2020-09-12 12:51 ` [PATCH 1/6] of: Add basic infrastructure to create early probe arrays Marc Zyngier
2020-09-12 23:20 ` Bjorn Andersson [this message]
2020-09-13 2:40 ` Bjorn Andersson
2020-09-12 12:51 ` [PATCH 2/6] irqchip: Make IRQCHIP_MATCH() type safe Marc Zyngier
2020-09-12 23:20 ` Bjorn Andersson
2020-09-12 12:51 ` [PATCH 3/6] irqchip: Introduce IRQCHIP_HYBRID_DRIVER_{BEGIN, END} macros Marc Zyngier
2020-09-12 23:21 ` Bjorn Andersson
2020-09-12 12:51 ` [PATCH 4/6] irqchip/mtk-cirq: Allow modular build Marc Zyngier
2020-09-12 23:22 ` Bjorn Andersson
2020-09-16 8:26 ` Enric Balletbo Serra
2020-09-12 12:51 ` [PATCH 5/6] irqchip/mtk-sysirq: " Marc Zyngier
2020-09-12 23:22 ` Bjorn Andersson
2020-09-16 8:22 ` Enric Balletbo Serra
2020-09-12 12:51 ` [PATCH 6/6] irqchip/qcom-pdc: " Marc Zyngier
2020-09-12 23:22 ` Bjorn Andersson
2020-09-14 20:33 ` [PATCH 0/6] irqchip: Hybrid probing John Stultz
2020-09-15 21:13 ` Rob Herring
2020-09-16 8:51 ` Marc Zyngier
2020-09-16 15:18 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200912232022.GE3715@yoga \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=enric.balletbo@collabora.com \
--cc=frowand.list@gmail.com \
--cc=hanks.chen@mediatek.com \
--cc=jason@lakedaemon.net \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@fw-web.de \
--cc=matthias.bgg@gmail.com \
--cc=maz@kernel.org \
--cc=robh+dt@kernel.org \
--cc=saravanak@google.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).