publishing OF platform devices

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri Mar 30 08:25:41 EST 2007


On Fri, 2007-03-30 at 00:18 +0200, Arnd Bergmann wrote:
> On Friday 30 March 2007, Benjamin Herrenschmidt wrote:
> > 
> > > The ppc_md->init() function is currently only present on 32 bit,
> > > if we decide that this is the way to go, we should make it common
> > > to both 32 and 64 bit platforms.
> > 
> > I still think we should do something like platform_xxx_initcall(); with
> > xxx being {core,subsys,device,...} ... I'll look into it. ppc_md.init()
> > is a bit gross.
> 
> Yes, that sounds like a good idea, but I'd much prefer adding these only
> if they actually simplify the existing code, rather than having them
> for completeness.

They will at first generate something like:

static int func(void)
{
	if (!machine_is(platform))
		return 0;
	return user_func();
}

xxx_initcall(func);

And thus will be equivalent in generated code to the open coded
versions, but that is already enough to avoid, I hope, quite a bit of
mistakes and simplify the source.

Later on, we can look into doing some smart ELF section tricks to also
reduce the generated code.

> We also might want to have something a lot simpler at first. Since
> many platforms just want to call
> 
> of_platform_bus_probe(NULL, foo_ids, NULL);
> 
> There could simply be an entry in ppc_md that gets set to foo_ids
> and we call of_platform_bus_probe() with that, and get rid of the
> unused root and parent arguments.

Might not be unused forever... oh well, we'll see.

Ben.





More information about the Linuxppc-dev mailing list