All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
To: Rob Herring <robh@kernel.org>
Cc: frowand.list@gmail.com, devicetree@vger.kernel.org
Subject: Re: [PATCH] of: get of_root directly in place of of_find_node_by_path("/")
Date: Wed, 7 Mar 2018 14:14:18 -0800	[thread overview]
Message-ID: <756e7632-bc0a-ae5f-f383-fbd3f0bf9135@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180307203847.l6jfxgizrzzwfrbr@rob-hp-laptop>

On 03/07/2018 12:38 PM, Rob Herring wrote:
> On Fri, Mar 02, 2018 at 08:46:44PM -0500, Tyrel Datwyler wrote:
>> There are a couple places in drivers/of where the root node is found
>> with a of_find_node_by_path("/") call. This call just returns
>> of_node_get(of_root) when the the path "/" is passed as a parameter.
>> So, lets fixup these instances to just do that instead.
>>
>> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
>> ---
>>  drivers/of/base.c     | 2 +-
>>  drivers/of/platform.c | 4 ++--
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>> index ad28de9..94c1b4d 100644
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>> @@ -455,7 +455,7 @@ int of_machine_is_compatible(const char *compat)
>>  	struct device_node *root;
>>  	int rc = 0;
>>  
>> -	root = of_find_node_by_path("/");
>> +	root = of_node_get(of_root);
> 
> The former seems more readable to me. I'll wait and see if Frank has any 
> comments on this change.

Fair enough. I find them equally readable now that we have a well named/defined global, namely "of_root",  pointing at the device tree root. My primary goal was saving a function call, but I wasn't sure if anybody really cares enough. A quick check shows ~77 uses of "of_find_node_by_path("/")" in the kernel. Figured I'd start here and see what the consensus was.

-Tyrel

> 
> Rob
> 


  reply	other threads:[~2018-03-07 22:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03  1:46 [PATCH] of: get of_root directly in place of of_find_node_by_path("/") Tyrel Datwyler
2018-03-07 20:38 ` Rob Herring
2018-03-07 22:14   ` Tyrel Datwyler [this message]
2018-03-07 22:21     ` Rob Herring
2018-03-07 23:59       ` Frank Rowand
2018-03-08  1:14         ` Rob Herring
2018-03-08  1:36           ` Frank Rowand
2018-03-08  1:36       ` Tyrel Datwyler
2018-03-08 14:09         ` 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=756e7632-bc0a-ae5f-f383-fbd3f0bf9135@linux.vnet.ibm.com \
    --to=tyreld@linux.vnet.ibm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=robh@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.