Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1730687ybl; Thu, 9 Jan 2020 00:17:17 -0800 (PST) X-Google-Smtp-Source: APXvYqwE2zI/iWyBgth08Daw2fcVjtwLM+vgc+aRkZxNOJLg8t+40Nj5vIVMbTRpVEnhSWZJgMj4 X-Received: by 2002:a9d:24e8:: with SMTP id z95mr7571154ota.5.1578557836819; Thu, 09 Jan 2020 00:17:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578557836; cv=none; d=google.com; s=arc-20160816; b=qVQHLxHFP6LuLQWqVRUBi+0Yydwl++lfqnxgnQ9UIgllg+90sQhy3lFruXQ66SdVnX 3fxB5PeHWTCo7qTQ6XC/YbGPOikshVJQkD9FEz5gbw838U/X/ny19AFu/0HyGbn+b1BZ beHOqqPrTc1VdQ12ciuWtdt0OschZ0qleaTVe+auhUK5kr8EIuWWAOPEL3wUbdyQpHFj 76PyS7cA3AaZotOETKC90MZPbkhurGDowT7AlE59MHw9Pz2xubxxabKEIf6onDksW34k u3mq1lvBtG62gEr4LL1UaoRVdMGv+H+xEzImwz82sia1KYU9J3Z9Mq6C2eddfagWRKDp o3nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5i9WcPR0wbXvCyiKCQMN/+XBmMwfHziesk5sjtK427Q=; b=hGzcskHABKiDILcTFbupWapcqOAn6Biezu54CuRvK2Ixk0TdYJJjwata2h5vk3s5r1 EupuWvUHx2RzxCgsm51U8/z+7OBst7snkm1txRVqAObHzv/2+Ge0Zoz9ZSg4cAetbG8D kbZHb5xgpx/5hKQhwSveMtubupeOO8Stxi40IrnySIHPBjxxkQqBMT9USUmBML3SZejh BN528uoQq3SLJ0pRwzCaaC+TH+s7vag9YCXZnnEDNBLe/F7cYikYUd5eH96FuuXqlu2P HbSnSHr1afDQk8CdZkir7NVXncMgOrwQdKezxxG9R7lUNQv2cZVQ3DFnj1TTo15FJD88 G2aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NFz7kL6R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18si3650937otf.285.2020.01.09.00.17.05; Thu, 09 Jan 2020 00:17:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NFz7kL6R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728405AbgAIIQO (ORCPT + 99 others); Thu, 9 Jan 2020 03:16:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:38976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728331AbgAIIQO (ORCPT ); Thu, 9 Jan 2020 03:16:14 -0500 Received: from T480 (98.142.130.235.16clouds.com [98.142.130.235]) (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 0C15520673; Thu, 9 Jan 2020 08:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578557774; bh=Ig8MmN3PyaZFfhXHd04xYCXqXztbORRcP6mk3OMhKnY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NFz7kL6Rli3iJa2zYrYYlZjt0VSUQ22isIyA1VxMG6wKcYMCe9VLNckYhxRwGBMgT 1+2m7RK5AwqLAeAyhcahD9ZLmVyatAKzjUAImqCGlgTxcpaOX7F96TpFYmGpLVAPZw 5hifcxbkywB4paXwMHunnTBrONed5/gDHLO1M5Hw= Date: Thu, 9 Jan 2020 16:16:04 +0800 From: Shawn Guo To: Peng Fan Cc: "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , dl-linux-imx , Anson Huang , Leonard Crestez , "cniedermaier@dh-electronics.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Alice Guo Subject: Re: [PATCH] ARM: imx: use of_root to simplify code Message-ID: <20200109081603.GI4456@T480> References: <1577696316-27635-1-git-send-email-peng.fan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1577696316-27635-1-git-send-email-peng.fan@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 30, 2019 at 09:03:51AM +0000, Peng Fan wrote: > From: Peng Fan > > 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 > --- > > 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 >