Re: [PATCH 2/2] mfd: twl4030: add twl4030-pwrbutton as our child

Andrew Morton
2009-02-27T22:12:40Z

On Fri, 27 Feb 2009 13:58:46 -0800
David Brownell <david-b@pacbell.net> wrote:

> On Friday 27 February 2009, Andrew Morton wrote:
> > > --- a/drivers/mfd/twl4030-core.c
> > > +++ b/drivers/mfd/twl4030-core.c
> > > @@ -101,6 +101,12 @@
> > > __#define twl_has_usb()________________false
> > > __#endif
> > > __
> > > +#if defined(CONFIG_INPUT_TWL4030_PWRBUTTON) \
> > > +__________|| defined(CONFIG_INPUT_TWL4030_PWBUTTON_MODULE)
> >
> > OK, this is "wrong". __The core shouldn't need to know about specific
> > clients.
>
> This is a pretty standard idiom:

That doesn't make it right.

> only create the device
> nodes a system actually uses.

That happens automatically if the nodes are made when the client
registers itself with the core.

> >
> > What has gone wrong here?
>
> Not much I can see. It's registering a platform_device,
> but only if it could be used on this system.

Again, that all gets fixed if this is done the right way around. Run
your probe function. If the hardware is there, register with the core
and all the nodes appear. If the hardware is not present: bale.

The design of the whole subsystem appears to be upside down :(