Re: [RFD] Functional dependencies between devices

From: Thierry Reding
Date: Thu Nov 19 2015 - 08:19:16 EST


On Tue, Nov 17, 2015 at 01:55:49PM +0000, Mark Brown wrote:
> On Tue, Nov 17, 2015 at 01:49:17PM +0100, Andrzej Hajda wrote:
> > On 10/27/2015 04:24 PM, Rafael J. Wysocki wrote:
>
> > this scenario:
> > - many clock providers, irq domains are not provided by devices,
>
> That seems like something we can and possibly should change if we want.

It's not very trivial, unfortunately. I had a crack at that a long time
ago, but the problem is that these devices all need to be available very
early during boot, at which point devices aren't registered yet. With
all the progress on probe deferral and the on-demand probing work this
might be less of an issue nowadays, I haven't looked at it for quite a
while.

But I fully agree that the current state of setting up providers without
a device structure is suboptimal precisely because it prevents generic
infrastructure like the one Rafael proposed from just working.

That said, one technique I've occasionally resorted to is to have some
early code, be it one of the OF table things or an initcall, set up a
basic environment, typically using global variables (yuck!), but then
provide a proper driver that knows how to take these things over when
its time comes. That's not a perfect solution, but at least it gives you
a proper struct device to work with.

Thierry

Attachment: signature.asc
Description: PGP signature