Subject: Re: RFC: new device types in the device tree (RE: [PATCH] powerpc: Add EDAC platform devices for 85xx)

From: Segher Boessenkool <[email-masked]>
Date: Sat, 5 May 2007 02:07:08 +0200

>>> name is always optional (as defined by b-w-of.txt)
>>
>> Where does it say that?  "name" is always required!  In
>> the newer flat tree format, it's even impossible to
>> create a node without "name".
>
> I'm specifically referring to the "name" property.  Here is
> what booting-without-of.txt says:

Okay, a few separate issues here...

>    While earlier users of Open Firmware like OldWorld
>    macintoshes tended to use the actual device name for
>    the "name" property, it's nowadays considered a good
>    practice to use a name that is closer to the device
>    class (often equal to device_type)...

Yes, this is known as "generic names" -- it makes device
trees more readable and easier to use (on real OF).  See
the "generic names" recommended practice document.

> [snip]... However,
>    the kernel doesn't generally put any restriction on the
>    "name" property; it is simply considered good practice
>    to follow the standard and its evolutions as closely as
>    possible.

When the kernel looks for a driver for a device node,
it should first consider "name" and after that the
entries in "compatible", in order.

Yes I know this is not what the kernel does most of
the time.

>    Note also that the new format version 16 makes the
>    "name" property optional. If it's absent for a node, then
>    the node's unit name is then used to reconstruct the name.
>    That is, the part of the unit name before the "@" sign
>    is used (or the entire unit name if no "@" sign is present).
>
> If the name property is missing the kernel contructs it from
> the unit name.

So there _always_ is a "name" property.  Who cares how
it is encoded in the DTB.

> I guess my point is the name property implies
> nothing and the kernel doesn't seem to care what name is used.

It does, in some cases.  See the bindings for "isa" and "pci"
busses for example (for the bus nodes, not the device nodes
under those).

> It certainly doesn't imply a required set of properties.

That depends on the specific binding for the type of
device; in most cases, some binding specific properties
_are_ required.

Segher