Re: [RFC] [PATCH] Device Tree on ARM platform

Benjamin Herrenschmidt
2009-05-28T08:01:20Z

On Wed, 2009-05-27 at 14:54 -0600, Grant Likely wrote:
> > Have to duplicated ressource handling via ifdef in every drivers is
> also an
> > overhead which need to be avoided
>
> agreed. I don't have a best of both worlds answer here.

Right and I don't advocate changing existing perfectly working platform
drivers, I think having wrappers to create them is fine.

In fact, I've been thinking for a long time about doing something like
that: Have those wrappers be registered via a standard OF set of match
strings for bus types and device types.

Then we can have a single loop that walks the tree, invoke those
"constructors" that return a struct device * (whatever the device
type that was actually created, could have been platform_device,
pci_dev, amba_device, etc...). It also passes them the parent device *

That way, all devices are instanciated from the DT -and- the topology
in sysfs preserves the topology in the device-tree (ie, parent/child
relationships are preserved).

Cheers,
Ben.