From: Rob Herring <robh@kernel.org>
To: Lizhi Hou <lizhi.hou@xilinx.com>
Cc: linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org,
maxz@xilinx.com, sonal.santan@xilinx.com, yliu@xilinx.com,
michal.simek@xilinx.com, stefanos@xilinx.com,
devicetree@vger.kernel.org, trix@redhat.com, mdf@kernel.org,
dwmw2@infradead.org, Max Zhen <max.zhen@xilinx.com>
Subject: Re: [PATCH V2 XRT Alveo Infrastructure 4/9] of: create empty of root
Date: Mon, 29 Nov 2021 19:59:46 -0600 [thread overview]
Message-ID: <YaWFksVvfQQWqKcG@robh.at.kernel.org> (raw)
In-Reply-To: <20211119222412.1092763-5-lizhi.hou@xilinx.com>
On Fri, Nov 19, 2021 at 02:24:07PM -0800, Lizhi Hou wrote:
> When OF_FLATTREE is selected and there is not a device tree, create an
> empty device tree root node. of/unittest.c code is referenced.
What does the last sentence mean? You copied the code? If so, that's a
sign you should refactor the unittest code to use this.
>
> Signed-off-by: Sonal Santan <sonal.santan@xilinx.com>
> Signed-off-by: Max Zhen <max.zhen@xilinx.com>
> Signed-off-by: Lizhi Hou <lizhi.hou@xilinx.com>
> ---
> drivers/of/Makefile | 2 +-
> drivers/of/fdt.c | 20 ++++++++++++++++++++
> drivers/of/fdt_default.dts | 5 +++++
> drivers/of/of_private.h | 5 +++++
> 4 files changed, 31 insertions(+), 1 deletion(-)
> create mode 100644 drivers/of/fdt_default.dts
>
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index c13b982084a3..815f5220465b 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -2,7 +2,7 @@
> obj-y = base.o device.o platform.o property.o
> obj-$(CONFIG_OF_KOBJ) += kobj.o
> obj-$(CONFIG_OF_DYNAMIC) += dynamic.o
> -obj-$(CONFIG_OF_FLATTREE) += fdt.o
> +obj-$(CONFIG_OF_FLATTREE) += fdt.o fdt_default.dtb.o
> obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o
> obj-$(CONFIG_OF_PROMTREE) += pdt.o
> obj-$(CONFIG_OF_ADDRESS) += address.o
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d64445e43ceb..3d6e4543419e 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -481,6 +481,26 @@ void *of_fdt_unflatten_tree(const unsigned long *blob,
> }
> EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree);
>
> +static int __init of_fdt_root_init(void)
> +{
> + struct device_node *np;
> +
> + if (of_root)
> + return 0;
> +
> + if (!of_fdt_unflatten_tree((const unsigned long *)__dtb_fdt_default_begin,
> + NULL, &of_root)) {
> + pr_warn("%s: unflatten default tree failed\n", __func__);
> + return -ENODATA;
> + }
> +
> + for_each_of_allnodes(np)
> + __of_attach_node_sysfs(np);
> +
> + return 0;
> +}
> +late_initcall(of_fdt_root_init);
> +
> /* Everything below here references initial_boot_params directly. */
> int __initdata dt_root_addr_cells;
> int __initdata dt_root_size_cells;
> diff --git a/drivers/of/fdt_default.dts b/drivers/of/fdt_default.dts
> new file mode 100644
> index 000000000000..d1f12a76dfc6
> --- /dev/null
> +++ b/drivers/of/fdt_default.dts
> @@ -0,0 +1,5 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/dts-v1/;
> +
> +/ {
> +};
> diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
> index 631489f7f8c0..47c6bb47ef25 100644
> --- a/drivers/of/of_private.h
> +++ b/drivers/of/of_private.h
> @@ -41,6 +41,11 @@ extern struct mutex of_mutex;
> extern struct list_head aliases_lookup;
> extern struct kset *of_kset;
>
> +#if defined(CONFIG_OF_FLATTREE)
> +extern u8 __dtb_fdt_default_begin[];
> +extern u8 __dtb_fdt_default_end[];
> +#endif
> +
> #if defined(CONFIG_OF_DYNAMIC)
> extern int of_property_notify(int action, struct device_node *np,
> struct property *prop, struct property *old_prop);
> --
> 2.27.0
>
>
next prev parent reply other threads:[~2021-11-30 1:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 22:24 [PATCH V2 XRT Alveo Infrastructure 0/9] XRT Alveo driver infrastructure overview Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 1/9] Documentation: fpga: Add a document describing XRT Alveo driver infrastructure Lizhi Hou
2021-12-02 7:04 ` Xu Yilun
2021-12-04 0:33 ` Lizhi Hou
2021-12-07 19:29 ` Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 2/9] Documentation: devicetree: bindings: add xrt group binding Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 3/9] of: handle fdt buffer alignment inside unflatten function Lizhi Hou
2021-11-30 1:57 ` Rob Herring
2021-11-30 21:13 ` Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 4/9] of: create empty of root Lizhi Hou
2021-11-30 1:59 ` Rob Herring [this message]
2021-11-30 21:21 ` Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 5/9] fpga: xrt: xrt-lib initialization Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 6/9] fpga: xrt: xrt bus and device Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 7/9] fpga: xrt: lib-xrt xroot APIs Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 8/9] fpga: xrt: xrt group device driver Lizhi Hou
2021-11-19 22:24 ` [PATCH V2 XRT Alveo Infrastructure 9/9] fpga: xrt: management physical function driver Lizhi Hou
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=YaWFksVvfQQWqKcG@robh.at.kernel.org \
--to=robh@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@xilinx.com \
--cc=max.zhen@xilinx.com \
--cc=maxz@xilinx.com \
--cc=mdf@kernel.org \
--cc=michal.simek@xilinx.com \
--cc=sonal.santan@xilinx.com \
--cc=stefanos@xilinx.com \
--cc=trix@redhat.com \
--cc=yliu@xilinx.com \
/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