Re: [PATCH] AB3100 regulator support v1

From: Linus Walleij
Date: Sun Aug 30 2009 - 08:52:11 EST


2009/8/30 Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>:

> [While setting up a child platform device from a platform driver
> probe...]
>
>> >> +     /* This would seem logical but makes everything break... */
>> >> +     /* pdev->dev.parent = parent; */
>
>> > Err...  it does?  In what way?
>
>> The sub-platform devices are added, but when I add a platform driver for
>> them, the probing does not commence, because they hang in
>> driver base/dd.c: __driver_attach() trying to take the parent semaphore,
>> i.e. this line:
>
>>       if (dev->parent)        /* Needed for USB */
>>               down(&dev->parent->sem);
>
>> In this case the parent is ab3100-regulators, the platform device for
>> the set of regulators.
>
> On the face of it (and without having actually looked at a running
> system or anything yet) I'm rather surprised that platform based MFD
> drivers aren't running into this issue more often.  CCing in Alan who
> made the change.

I think it hasn't happened a lot because most MFD:s spawn their
platform device children at subsystem_init and then register drivers
for them at driver_init. E.g. all the wm8350 children have their
drivers at higher init levels, except for the regulators which are by
chance saved by having the i2c device as parent.

> However, fixing this is not required to avoid the issue for this
> particular driver.  The problem is being caused because in addition to
> the core MFD driver for the device you've chosen to create both a
> platform device covering all regulators and further per-regulator child
> platform devices.

Yeah I know, I thought it was elegant... :-/

> If you create only one level of child device for the
> MFD you'll avoid the issue because your core device is an I2C device.
> Either have a device per regulator or have a single device which
> registers multiple regulators.

Yep I elaborated registering multiple regulators to the ab3100-regulators
platform device, I'll try this.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/