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

From: Javier Martinez Canillas
Date: Tue May 05 2015 - 06:58:04 EST


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
--
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/