[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180822144655.GO14967@localhost>
Date: Wed, 22 Aug 2018 16:46:55 +0200
From: Johan Hovold <johan@...nel.org>
To: Rob Herring <robh@...nel.org>
Cc: Johan <johan@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Frank Rowand <frowand.list@...il.com>,
devicetree@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
ck.hu@...iatek.com, p.zabel@...gutronix.de,
Rob Clark <robdclark@...il.com>, airlied@...ux.ie,
Ulf Hansson <ulf.hansson@...aro.org>, rainyfeeling@...look.com,
boris.brezillon@...tlin.com, opendmb@...il.com,
Florian Fainelli <f.fainelli@...il.com>, davem@...emloft.net,
peppe.cavallaro@...com, alexandre.torgue@...com,
joabreu@...opsys.com, sameo@...ux.intel.com, sre@...nel.org
Subject: Re: [PATCH 0/9] of: fix compatible-child-node lookups
On Wed, Aug 22, 2018 at 09:32:11AM -0500, Rob Herring wrote:
> On Wed, Aug 22, 2018 at 5:57 AM Johan Hovold <johan@...nel.org> wrote:
> >
> > Several drivers currently use of_find_compatible_node() to lookup child
> > nodes while failing to notice that the of_find_ functions search the
> > entire tree depth-first and therefore can match unrelated (non-child)
> > nodes.
>
> That is not quite right. It searches all nodes following 'from', so
> not the entire tree unless 'from' is NULL. The purpose of 'from' is to
> iterate to find all compatible nodes. But you are correct that anyone
> calling of_find_compatible_node directly with from != NULL is wrong.
Yeah, sorry, I guess I could have been more specific. I just find
qualifying "searching the entire tree" with "starting from the node
specified in the first argument" to be too cumbersome to write. And it's
sort of implicit as the functions *are* iterators meant for searching
the entire tree (passing NULL as the first argument the first time).
> > This is related to the fixes I posted about a year ago, which addressed
> > a similar anti-pattern when looking up child nodes by name. Since it
> > took me more than a year to get all those fixes into Linus' tree (one
> > fix is still pending), and as these fixes depend on the new helper, I'm
> > suggesting that these all go in through Rob's or Greg's trees.
>
> I'm happy to take them or apply the dependency now and then anything
> not picked up by sub-maintainers for 4.20.
Thanks, let's see if what the others prefer.
Johan
Powered by blists - more mailing lists