Re: [PATCH v2] mfd: tqmx86: IO controller with i2c, wachdog and gpio

From: Andrew Lunn
Date: Fri Dec 21 2018 - 16:28:57 EST


> > +static int tqmx86_create_platform_device(const struct dmi_system_id *id)
>
> This blows my mind.
>
> - The normal module_init() calls are initiated calling for a DMI scan
> - Then the DMI device init()s
> - You use the DMI init() to register this device as a platform device
> - Then this platform device then probes
>
> That seems very incestuous.
>
> What is the reason for all the hoop jumping?

Hi Lee

It does seem like a lot of hoops to jump through. But i don't see a
way to avoid it. When you are matching on DMI tables, all you appear
to be able to do is register a callback to be called. This callback
cannot be used as a driver probe, you cannot return -EPROBE_DEFER and
expect it to be called again, etc. So if you do want to create a
device, you need to go via a platform_device.

If you know of a better way, i would be happy to implement it.

Thanks
Andrew