[PATCH 1/3] fdt.c: Add non-boottime device tree functions

Grant Likely grant.likely at secretlab.ca
Thu Nov 18 16:35:36 EST 2010


On Wed, Nov 17, 2010 at 3:53 PM, Stephen Neuendorffer
<stephen.neuendorffer at xilinx.com> wrote:
>
>
>> -----Original Message-----
>> From: Grant Likely [mailto:glikely at secretlab.ca] On Behalf Of Grant
> Likely
>> Sent: Wednesday, November 17, 2010 11:42 AM
>> To: Stephen Neuendorffer
>> Cc: dirk.brandewie at gmail.com; devicetree-discuss at lists.ozlabs.org
>> Subject: Re: [PATCH 1/3] fdt.c: Add non-boottime device tree functions
>>
>> On Wed, Nov 17, 2010 at 11:15:43AM -0800, Stephen Neuendorffer wrote:
>> > In preparation for providing run-time handling of device trees,
> factor
>> > out some of the basic functions so that they take an arbitrary blob,
>> > rather than relying on the single boot-time tree.
>> >
>> > Signed-off-by: Stephen Neuendorffer
> <stephen.neuendorffer at xilinx.com>
>> > ---
>> >  drivers/of/fdt.c       |  129
> ++++++++++++++++++++++++++++++-----------------
>> >  include/linux/of_fdt.h |    9 +++
>> >  2 files changed, 91 insertions(+), 47 deletions(-)
>> >
>> > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>> > index c1360e0..6ae207a 100644
>> > --- a/drivers/of/fdt.c
>> > +++ b/drivers/of/fdt.c
>> > @@ -22,6 +22,86 @@
>> >
>> >  #include <asm/page.h>
>> >
>> > +char *fdt_get_string(u32 offset,
>> > +                     struct boot_param_header *blob)
>>
>> nitpicking: Encouraged naming convention is of_flat_dt_* for this
>> file.  Also, I think it makes more sense for blob to be the first
>> argument in all of these functions.
>
> If I do the rename, then of_flat_dt_is_compatible has a conflict with
> the non-blob function, which is
> used all over the place in the powerpc platform code.  It seems like
> there's already alot of nonsense
> between drivers/of/fdt.c, CONFIG_FLATTREE, and of_flat_dt_* conventions.
> Perhaps a non conflicting
> convention?  of_fdt_* (to match the file) or flattree_* (to match the
> Kconfig option).

Just discussed this on IRC, and even got into the prospect of
replacing the 'of' abbreviation entirely with something like 'dt'
('cause everyone agrees 'of' sucks, and can't figure out why we agreed
to that prefix in the first place).  The flat tree functions are also
get renamed to fdt_*

However, looking at the scope of the change, I doubt that the of_ -->
dt_ rename will actually happen.  So, in order to remain at least
slightly consistent, go ahead and use the of_fdt_ prefix if this
patch.  Bonus points if you also post a patch to rename the old
function names to of_fdt_initial_* (or something) and fixup all the
users (should be trivial since it will just be a global search and
replace).

g.


More information about the devicetree-discuss mailing list