public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Shawn Guo <shawnguo@kernel.org>
To: Peng Fan <peng.fan@nxp.com>
Cc: "cniedermaier@dh-electronics.com"
	<cniedermaier@dh-electronics.com>,
	Anson Huang <anson.huang@nxp.com>, Alice Guo <alice.guo@nxp.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	Leonard Crestez <leonard.crestez@nxp.com>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] ARM: imx: use of_root to simplify code
Date: Thu, 9 Jan 2020 16:16:04 +0800	[thread overview]
Message-ID: <20200109081603.GI4456@T480> (raw)
In-Reply-To: <1577696316-27635-1-git-send-email-peng.fan@nxp.com>

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
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-01-09  8:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30  9:03 [PATCH] ARM: imx: use of_root to simplify code Peng Fan
2020-01-09  8:16 ` Shawn Guo [this message]
2020-01-09  8:20   ` Peng Fan

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=20200109081603.GI4456@T480 \
    --to=shawnguo@kernel.org \
    --cc=alice.guo@nxp.com \
    --cc=anson.huang@nxp.com \
    --cc=cniedermaier@dh-electronics.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.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