generating a phandle w/libfdt?

Kumar Gala galak at kernel.crashing.org
Wed Oct 29 14:47:39 EST 2008


On Oct 27, 2008, at 7:04 PM, David Gibson wrote:

> On Mon, Oct 27, 2008 at 09:15:38AM -0500, Kumar Gala wrote:
>>
>> On Oct 26, 2008, at 6:40 PM, David Gibson wrote:
>>
>>> On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote:
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From:
>>>>> devicetree-discuss-bounces+stuart.yoder=freescale.com at ozlabs.o
>>>>> rg
>>>>> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@
>>>> ozlabs.org] On Behalf Of Kumar Gala
>>>>> Sent: Friday, October 24, 2008 9:19 AM
>>>>> To: devicetree-discuss
>>>>> Subject: Re: generating a phandle w/libfdt?
>>>>>
>>>>>
>>>>> On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote:
>>>>>
>>>>>> In some work I'm doing I noticed we don't have any APIs to
>>>>> generate
>>>>>> a phandle via libfdt.
>>>>>>
>>>>>> was wondering if anyone had ideas on this.
>>>>>>
>>>>>> In first thought it seems we have to scan through the whole blob
>>>>>> looking for the largest phandle id and than +1 it to generate the
>>>>>> next "valid" id.  Any other ideas on how to do this more
>>>>> efficiently?
>>>>>
>>>>> The other question is there a way today to create a phandle even  
>>>>> if
>>>>> there isn't a reference to it elsewhere in a .dts?
>>>>
>>>> We had this issue and the 'hack' was to create a phandle property
>>>> in the node itself, so it was self-referenced.  That caused DTC
>>>> to allocate a phandle.   We then could reference the node from
>>>> dynamically generated nodes.
>>>
>>> That's nasty.  I should add a way to make dtc generate a phandle  
>>> for a
>>> node, even if it's not referenced from elsewhere.  Just need to  
>>> think
>>> of a decent syntax.
>>
>> What if we just have it do that if we have a "linux,phandle" property
>> w/o a value in the .dts?
>
> Hrm.  Normally that would create a property named "linux,phandle" with
> a zero-length value.  I'm disinclined to special case this.

Why?  linux,phandle is already special.  What does it mean if a  
linux,phandle has no value?

- k



More information about the devicetree-discuss mailing list