Re: [PATCH] RFC: platform driver registering via initcall tables

From: Greg KH
Date: Tue Dec 17 2019 - 09:06:56 EST


On Tue, Dec 17, 2019 at 02:44:39PM +0100, Enrico Weigelt, metux IT consult wrote:
> On 17.12.19 11:31, Greg KH wrote:
>
> Hi,
>
> > No, what is so "special" about platform drivers that they require this?
>
> Nothing, of course ;-)
>
> It's the the starting point for this PoC. The idea actually is doing
> this for all other driver types, too (eg. spi, pci, usb, ...). But
> they'll need their own tables, as different *_register() functions have
> to be called - just haven't implemented that yet.

That's not needed, and you are going to break the implicit ordering we
already have with link order. You are going to have to figure out what
bus type the driver is, to determine what segment it was in, to figure
out what was loaded before what.

Not good.

> > If anything, we should be moving _AWAY_ from platform drivers and use
> > real bus drivers instead.
>
> That would be nice, but, unfortunately, we have lots of devices which
> aren't attached to any (probing-capable) bus. That's why we have things
> like oftree, etc.
>
> > Please no, I don't see why this is even needed.
>
> The idea is getting rid of all the init code, which all just does the
> same, just calls some *_register() function.

There's no need to get rid of it, what are you trying to save here? How
can you be sure init order is still the same?

thanks,

greg k-h