[PATCH 06/10] mfd add subdevs in 88pm860x

Haojian Zhuang haojian.zhuang at gmail.com
Fri Nov 20 04:14:45 EST 2009


On Thu, Nov 19, 2009 at 10:07 PM, Haojian Zhuang
<haojian.zhuang at gmail.com> wrote:
> On Wed, Nov 18, 2009 at 12:16 AM, Dmitry Torokhov
> <dmitry.torokhov at gmail.com> wrote:
>>> @@ -354,23 +510,46 @@ int __devinit pm860x_device_init(struct
>>> pm860x_chip *chip, void *pdata)
>>>               mutex_init(&mixed_chip.io_lock);
>>>
>>>       if (!strcmp(chip->id.name, "88PM8607")) {
>>> -             ret = __88pm8607_init(chip, (struct pm860x_plat_data *)pdata);
>>> +             ret = __88pm8607_init(chip, pdata);
>>>               if (ret < 0)
>>>                       goto out;
>>>
>>> -             count = ARRAY_SIZE(pm8607_devs);
>>> -             for (i = 0; i < count; i++) {
>>> -                     ret = mfd_add_devices(chip->dev, i, &pm8607_devs[i],
>>> -                                           1, NULL, 0);
>>> -                     if (ret != 0) {
>>> -                             dev_err(chip->dev, "Failed to add subdevs\n");
>>> -                             goto out;
>>> -                     }
>>> +             ret = mfd_add_devices(chip->dev, 0, &regulator_devs[0],
>>> +                                   ARRAY_SIZE(regulator_devs),
>>> +                                   &regulator_resources[0], 0);
>>> +             if (ret < 0)
>>> +                     dev_err(chip->dev, "Failed to add regulator subdev\n");
>>> +
>>> +             if (pdata && pdata->touch) {
>>> +                     ret = mfd_add_devices(chip->dev, 0, &touch_devs[0],
>>> +                                     ARRAY_SIZE(touch_devs),
>>> +                                     &touch_resources[0], 0);
>>> +                     if (ret < 0)
>>> +                             dev_err(chip->dev, "Failed to add touch "
>>> +                                     "subdev\n");
>>
>> Umm, when I was asking for error handling I expected more than just
>> printing a message. What about cleanup? Is device functional without
>> half of the devices? Do we want to have a crippled device?
>>
>> Thanks.
>>
>> --
>> Dmitry
>>
>
> updated
>
> Thanks
> Haojian
>

Update for releasing irq if registering mfd subdevices failure.

Thanks
Haojian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-mfd-append-subdev-into-88pm860x-driver.patch
Type: text/x-patch
Size: 14568 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091120/594a3446/attachment-0001.bin>


More information about the linux-arm-kernel mailing list