All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pantelis Antoniou <panto@antoniou-consulting.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Rob Herring <rob.herring@calxeda.com>,
	Rob Landley <rob@landley.net>, Jon Loeliger <jdl@jdl.com>,
	Tony Lindgren <tony@atomide.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Benoit Cousson <b-cousson@ti.com>,
	Mitch Bradley <wmb@firmworks.com>, Alan Tull <atull@altera.com>,
	linux-omap@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Matt Porter <mporter@ti.com>, Russ Dill <Russ.Dill@ti.com>,
	Koen Kooi <koen@dominion.thruhere.net>,
	Joel A Fernandes <agnel.joel@gmail.com>,
	Rob Clark <robdclark@gmail.com>,
	Jason Kridner <jkridner@beagleboard.org>,
	Matt Ranostay <mranostay@gmail.com>
Subject: Re: [PATCH 5/6] OF: Introduce Device Tree resolve support.
Date: Thu, 21 Mar 2013 11:12:44 +0200	[thread overview]
Message-ID: <E7AB277F-5875-4533-8977-18E09CA1EEDC@antoniou-consulting.com> (raw)
In-Reply-To: <20130319171848.733493E33F5@localhost>

Hi Grant,

On Mar 19, 2013, at 7:18 PM, Grant Likely wrote:

> On Tue, 19 Mar 2013 13:51:01 +0200, Pantelis Antoniou <panto@antoniou-consulting.com> wrote:
>> Hi Grant,
>> 
>> On Mar 16, 2013, at 11:24 AM, Grant Likely wrote:
>> 
>>> On Wed, 23 Jan 2013 12:58:02 +0200, Pantelis Antoniou <panto@antoniou-consulting.com> wrote:
>>>> Hi David,
>>>> 
>>>> On Jan 23, 2013, at 6:40 AM, David Gibson wrote:
>>>>> Ok.  Nonetheless it's not hard to avoid a recursive approach here.
>>>> 
>>>> How can I find the maximum phandle value of a subtree without using recursion.
>>>> Note that the whole function is just 6 lines long.
>>> 
>>> It's a failure in the existing kernel DT data structures. We need a hash
>>> lookup for the phandles to eliminate the search entirely. Then you'd be
>>> able to allocated new phandles on the fly easily and resolve phandles
>>> without searching the whole tree (which has always been horrible).
>>> 
>> 
>> Yes, it is pretty obvious that the in-kernel data structures are sub-optimal.
>> But I was not after modifying them, since that's a different kind of problem.
> 
> Think about it this way; fixing up that aspect of the data structure
> makes the job you're trying to do a lot easier. I don't feel bad about
> asking you to add a radix tree for phandle lookups when it makes your
> patches a whole lot better.  :-)
> 

Oh that's going to be fun... maybe.

>> Since we're having a 'sub-optimal' data structures, I'd like to point out that
>> the usage of of_find_by_name(), mostly by drivers trying to find a child
>> of their own node, works by a lucky accident of how the device nodes are instantiated
>> by the flat tree loader. Most of the use cases should be replaced by a call
>> to of_get_child_by_name() which does the right thing.
> 
> It is true. In fact, calling of_find_node_by_name() when using .dtb is
> most likely a bug since using node name to determine behaviour is
> strongly discouraged.

Maybe mark the function as deprecated then? Easier to get people to fix it.

> 
>> Fair enough, but be warned that phandle resolution the overlay feature is mostly useless.
>> 
>> In actual practice the amount of driver nodes that can be overlaid without a single case
>> of referencing phandles outside (or within) their own blob is close to zero.
> 
> That's not what I'm saying. I'm saying that (at least for now) we should
> require the overlay to already know the phandles from the parent and to
> refuse to load an overlay that defines phandles already in use in the
> base. Overlays do become usable at that point. A mechanism for phandle
> resolution so that conflicts can be found and resolved can be added
> as a feature enhancement. By splitting it out you'll be able to get the
> overlay feature merged even if we don't have agreement on the resolution
> mechanism yet.
> 

As long as we don't come up with something that's too difficult to use for non
kernel developers. I would hate to punt and push all the complexity of phandle
resolution to the driver/cape developer.

FWIW, the resolution mechanism we use on the beaglebone seems to work just fine,
and people seem to handle it just fine. The part that trips them is mostly how
to install the updated dtc compiler that's required.

> g.
> 

Regards

-- Pantelis


  reply	other threads:[~2013-03-21  9:12 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-04 19:31 [PATCH 0/6] Introducing Device Tree Overlays Pantelis Antoniou
2013-01-04 19:31 ` Pantelis Antoniou
2013-01-04 19:31 ` [PATCH 1/6] OF: Introduce device tree node flag helpers Pantelis Antoniou
2013-01-04 19:31   ` Pantelis Antoniou
2013-01-04 19:31 ` [PATCH 2/6] OF: export of_property_notify Pantelis Antoniou
2013-01-04 19:31   ` Pantelis Antoniou
2013-01-04 19:31 ` [PATCH 3/6] OF: Export all DT proc update functions Pantelis Antoniou
2013-01-04 19:31   ` Pantelis Antoniou
2013-03-16  9:45   ` Grant Likely
2013-03-16  9:45     ` Grant Likely
2013-03-19 11:42     ` Pantelis Antoniou
2013-03-19 11:42       ` Pantelis Antoniou
2013-03-19 17:08       ` Grant Likely
2013-03-16  9:53   ` Grant Likely
2013-03-16  9:53     ` Grant Likely
2013-01-04 19:31 ` [PATCH 4/6] OF: Introduce utility helper functions Pantelis Antoniou
2013-01-04 19:31   ` Pantelis Antoniou
2013-01-04 19:31 ` [PATCH 5/6] OF: Introduce Device Tree resolve support Pantelis Antoniou
2013-01-04 19:31   ` Pantelis Antoniou
2013-01-21  4:48   ` David Gibson
2013-01-21  4:48     ` David Gibson
2013-01-21 10:59     ` Pantelis Antoniou
2013-01-22  4:05       ` David Gibson
2013-01-22 11:06         ` Pantelis Antoniou
2013-01-22 11:06           ` Pantelis Antoniou
2013-01-23  4:40           ` David Gibson
2013-01-23 10:58             ` Pantelis Antoniou
2013-03-16  9:24               ` Grant Likely
2013-03-19 11:51                 ` Pantelis Antoniou
2013-03-19 17:18                   ` Grant Likely
2013-03-21  9:12                     ` Pantelis Antoniou [this message]
2013-01-04 19:31 ` [PATCH 6/6] OF: Introduce DT overlay support Pantelis Antoniou
2013-01-04 19:31   ` Pantelis Antoniou
2013-01-06  2:24   ` Rob Landley
2013-01-06  2:24     ` Rob Landley
2013-01-07 10:45     ` Pantelis Antoniou
2013-01-22  3:50   ` David Gibson
2013-01-22 11:08     ` Pantelis Antoniou
2013-01-23  5:12       ` David Gibson
2013-01-23 11:01         ` Pantelis Antoniou
2013-01-25  2:34           ` David Gibson
2013-01-05  3:35 ` [PATCH 0/6] Introducing Device Tree Overlays Richard Cochran
2013-01-05  3:35   ` Richard Cochran
2013-01-05  6:16   ` Joel A Fernandes
2013-01-05  6:16     ` Joel A Fernandes
2013-01-05  9:35     ` Richard Cochran
2013-01-05 10:13       ` Pantelis Antoniou
2013-01-05 10:13         ` Pantelis Antoniou
2013-01-06  4:37       ` Rob Landley
2013-01-06  4:37         ` Rob Landley
2013-02-21 21:25 ` delicious quinoa
2013-02-21 21:53   ` Pantelis Antoniou
2013-02-21 21:53     ` Pantelis Antoniou
2013-02-22 15:57     ` delicious quinoa
2013-06-29  2:38 ` Guenter Roeck
2013-07-01  9:46   ` Pantelis Antoniou
2013-07-02  3:55     ` Guenter Roeck
2013-07-03  8:25   ` Pantelis Antoniou

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=E7AB277F-5875-4533-8977-18E09CA1EEDC@antoniou-consulting.com \
    --to=panto@antoniou-consulting.com \
    --cc=Russ.Dill@ti.com \
    --cc=agnel.joel@gmail.com \
    --cc=atull@altera.com \
    --cc=b-cousson@ti.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jdl@jdl.com \
    --cc=jkridner@beagleboard.org \
    --cc=koen@dominion.thruhere.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mporter@ti.com \
    --cc=mranostay@gmail.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=robdclark@gmail.com \
    --cc=swarren@wwwdotorg.org \
    --cc=tony@atomide.com \
    --cc=wmb@firmworks.com \
    /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.