2009-07-22 19:27:52

by Trilok Soni

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

Hi Andrew/Samuel,

On Sat, Feb 28, 2009 at 5:12 AM, Andrew Morton<[email protected]> wrote:
> On Fri, 27 Feb 2009 15:20:56 -0800
> David Brownell <[email protected]> wrote:
>
>> On Friday 27 February 2009, Andrew Morton wrote:
>> > > >
>> > > > 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.
>>
>> Right. ?If there's no button hooked up to its "power button"
>> signal, don't register that "twl4030-pwrbutton" node.
>>
>>
>> > The design of the whole subsystem appears to be upside down :(
>>
>> You seem to be missing something. ?Is it only the lack of that
>> tweak Felipe sent?
>
> I generally just delete unchangelogged patches.
>
> <goes back and finds it>
>
>
> That doesn't address the problem at all. ?A function called
> "add_children" just shouldn't exist. ?The general kernel design is for
> client drivers to register themselves with the core, so the core does
> not have any hard-wired knowledge of any client drivers.
>
> IOW, twl4030_pwrbutton_probe() should call into twl4030-core,
> registering the powerbutton driver.
>

Reviving this very old thread.

Andrew,

It seems that every driver under "mfd" is following the more or less
approach like twl4030, where the core driver is creating sub-device
driver's platform devices based on either some conditions like
platform data for that sub-device driver is available or not, or
sub-device array with it's "name" and "id" is passed from arch/ board
files.

Samuel,

I don't see any further discussion of points raised by Andrew in this driver.


--
---Trilok Soni
http://triloksoni.wordpress.com
http://www.linkedin.com/in/triloksoni


2009-07-22 22:25:56

by David Brownell

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

On Wednesday 22 July 2009, Trilok Soni wrote:
> > That doesn't address the problem at all. ?A function called
> > "add_children" just shouldn't exist. ?The general kernel design is for
> > client drivers to register themselves with the core, so the core does
> > not have any hard-wired knowledge of any client drivers.

The general kernel design also involves bus drivers
(consider PCI or USB) enumerating their child devices
and then *adding* those children ... that's what is
done here. The devices supported by that system get
added, and then the driver model code can bind each
device to its driver.


> > IOW, twl4030_pwrbutton_probe() should call into twl4030-core,
> > registering the powerbutton driver.

It calls to the driver model to register that driver,
which then sees that the device is registered.

- Dave


>
> Reviving this very old thread.
>