Re: [TECH TOPIC] Driver probe fails and register succeeds

Greg KH
2022-06-24T06:33:13Z

On Thu, Jun 23, 2022 at 06:00:06PM -0700, Dmitry Torokhov wrote:
> Nor does this work for drivers for devices that might be hot-plugged,
> instantiated via sysfs/new_id, etc, etc.

Agreed.

> So if you want to fail driver registration because you know that you are
> dealing with a singleton platform device with no additional dependencies
> then it has to be done in the driver itself, not by the driver core.

And even then, it really should not be done in the driver, that is not
how Linux drivers should work at all. That's why we have macros to make
it so that module_init() just calls [SUBSYSTEM]_register() for the
subsystem in question, and the module is not supposed to do anything
else.

thanks,

greg k-h