Re: [RESEND PATCH 3/8] mfd: cros_ec: Instantiate sub-devices from device tree

Javier Martinez Canillas
2015-05-05T10:58:00Z

Hello Lee,

On 05/05/2015 12:53 PM, Lee Jones wrote:
> On Tue, 05 May 2015, Javier Martinez Canillas wrote:
>> >> };
>> >>
>> >> @@ -150,6 +141,15 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
>> >> return err;
>> >> }
>> >>
>> >> +#ifdef CONFIG_OF
>> >> + err = of_platform_populate(dev->of_node, NULL, NULL, dev);
>> >> + if (err) {
>> >> + mfd_remove_devices(dev);
>> >> + dev_err(dev, "Failed to register sub-devices\n");
>> >> + return err;
>> >> + }
>> >> +#endif
>> >
>> > And if we don't support OF?
>> >
>>
>> These sub-devices are only present on machines that support OF so
>> is more flexible to use of_platform_populate() to register those.
>>
>> Both machines using and not using DT, register a cros-ec-ctl which
>> is still a mfd_cell in the cros_devs array.
>
> I'm not really a fan of #ifdiffery if it can be avoided.
>
> How about?
>
> if (np)
> cros_ec_of_register();
>

Works for me, I'll change it to avoid the ifdeffery.

Best regards,
Javier