* [PATCH] ARM: imx: use of_root to simplify code
@ 2019-12-30 9:03 Peng Fan
2020-01-09 8:16 ` Shawn Guo
0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan @ 2019-12-30 9:03 UTC (permalink / raw)
To: shawnguo, s.hauer, kernel, festevam
Cc: dl-linux-imx, Anson Huang, Leonard Crestez, cniedermaier,
linux-arm-kernel, linux-kernel, Alice Guo, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
start_kernel
|->setup_arch
| |->unflatten_device_tree->of_root ready
|
|->do_initcalls
|->customize_machine
|->init_machine
|->imx_soc_device_init
When imx_soc_device_init, of_root is ready, so we could directly use it.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
V1:
Tested on i.MX7D-SDB
arch/arm/mach-imx/cpu.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index 06f8d64b65af..77319b359070 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -88,7 +88,6 @@ struct device * __init imx_soc_device_init(void)
struct soc_device_attribute *soc_dev_attr;
const char *ocotp_compat = NULL;
struct soc_device *soc_dev;
- struct device_node *root;
struct regmap *ocotp = NULL;
const char *soc_id;
u64 soc_uid = 0;
@@ -101,9 +100,7 @@ struct device * __init imx_soc_device_init(void)
soc_dev_attr->family = "Freescale i.MX";
- root = of_find_node_by_path("/");
- ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
- of_node_put(root);
+ ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
if (ret)
goto free_soc;
--
2.16.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: imx: use of_root to simplify code
2019-12-30 9:03 [PATCH] ARM: imx: use of_root to simplify code Peng Fan
@ 2020-01-09 8:16 ` Shawn Guo
2020-01-09 8:20 ` Peng Fan
0 siblings, 1 reply; 3+ messages in thread
From: Shawn Guo @ 2020-01-09 8:16 UTC (permalink / raw)
To: Peng Fan
Cc: s.hauer, kernel, festevam, dl-linux-imx, Anson Huang,
Leonard Crestez, cniedermaier, linux-arm-kernel, linux-kernel,
Alice Guo
On Mon, Dec 30, 2019 at 09:03:51AM +0000, Peng Fan wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> start_kernel
> |->setup_arch
> | |->unflatten_device_tree->of_root ready
> |
> |->do_initcalls
> |->customize_machine
> |->init_machine
> |->imx_soc_device_init
>
> When imx_soc_device_init, of_root is ready, so we could directly use it.
IMO, of_root is something for OF core code, not really for platform.
Shawn
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>
> V1:
> Tested on i.MX7D-SDB
>
> arch/arm/mach-imx/cpu.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
> index 06f8d64b65af..77319b359070 100644
> --- a/arch/arm/mach-imx/cpu.c
> +++ b/arch/arm/mach-imx/cpu.c
> @@ -88,7 +88,6 @@ struct device * __init imx_soc_device_init(void)
> struct soc_device_attribute *soc_dev_attr;
> const char *ocotp_compat = NULL;
> struct soc_device *soc_dev;
> - struct device_node *root;
> struct regmap *ocotp = NULL;
> const char *soc_id;
> u64 soc_uid = 0;
> @@ -101,9 +100,7 @@ struct device * __init imx_soc_device_init(void)
>
> soc_dev_attr->family = "Freescale i.MX";
>
> - root = of_find_node_by_path("/");
> - ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
> - of_node_put(root);
> + ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
> if (ret)
> goto free_soc;
>
> --
> 2.16.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] ARM: imx: use of_root to simplify code
2020-01-09 8:16 ` Shawn Guo
@ 2020-01-09 8:20 ` Peng Fan
0 siblings, 0 replies; 3+ messages in thread
From: Peng Fan @ 2020-01-09 8:20 UTC (permalink / raw)
To: Shawn Guo, robh+dt
Cc: s.hauer, kernel, festevam, dl-linux-imx, Anson Huang,
Leonard Crestez, cniedermaier, linux-arm-kernel, linux-kernel,
Alice Guo
+Rob
Hi Shawn,
> Subject: Re: [PATCH] ARM: imx: use of_root to simplify code
>
> On Mon, Dec 30, 2019 at 09:03:51AM +0000, Peng Fan wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > start_kernel
> > |->setup_arch
> > | |->unflatten_device_tree->of_root ready
> > |
> > |->do_initcalls
> > |->customize_machine
> > |->init_machine
> > |->imx_soc_device_init
> >
> > When imx_soc_device_init, of_root is ready, so we could directly use it.
>
> IMO, of_root is something for OF core code, not really for platform.
From below link, I see powerpc and some driver use of_root directly.
https://elixir.bootlin.com/linux/v5.5-rc5/ident/of_root
of_root is exported as a symbol. Rob, could you please clarify whether
platform code could use of_root directly?
Thanks,
Peng.
>
> Shawn
>
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >
> > V1:
> > Tested on i.MX7D-SDB
> >
> > arch/arm/mach-imx/cpu.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index
> > 06f8d64b65af..77319b359070 100644
> > --- a/arch/arm/mach-imx/cpu.c
> > +++ b/arch/arm/mach-imx/cpu.c
> > @@ -88,7 +88,6 @@ struct device * __init imx_soc_device_init(void)
> > struct soc_device_attribute *soc_dev_attr;
> > const char *ocotp_compat = NULL;
> > struct soc_device *soc_dev;
> > - struct device_node *root;
> > struct regmap *ocotp = NULL;
> > const char *soc_id;
> > u64 soc_uid = 0;
> > @@ -101,9 +100,7 @@ struct device * __init imx_soc_device_init(void)
> >
> > soc_dev_attr->family = "Freescale i.MX";
> >
> > - root = of_find_node_by_path("/");
> > - ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
> > - of_node_put(root);
> > + ret = of_property_read_string(of_root, "model",
> > +&soc_dev_attr->machine);
> > if (ret)
> > goto free_soc;
> >
> > --
> > 2.16.4
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-09 8:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 9:03 [PATCH] ARM: imx: use of_root to simplify code Peng Fan
2020-01-09 8:16 ` Shawn Guo
2020-01-09 8:20 ` Peng Fan
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).