Subject: Re: [PATCH 2 6/7] Uartlite: Add of-platform-bus binding

From: Benjamin Herrenschmidt <[email-masked]>
Date: Thu, 04 Oct 2007 07:21:40 +1000

On Wed, 2007-10-03 at 08:39 -0600, Grant Likely wrote:
> Right, okay.  Looking at platform_device_add(), the default parent is
> platform_bus, but it can be overridden.  of_platform_bus devices get
> the hierarchy of the device tree by default.  So in the platform bus
> case, the constructor would need to explicitly set the parent device?
> Correct?
> 
> Also, how do you see the constructor code getting executed?  Called
> explicitly from the platform code, or some form of auto binding?  I
> look at fsl_soc.c and I shudder as each constructor does a pass of the
> whole tree looking for compatible nodes.

My idea was to have some platform code at boot walk the DT and call the
constructors on the way, passing them the parent. Constructors return a
struct device * so it would keep track of who is where.

Drivers or platform code can then register constructors along with of
match tables.

Ben.