[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090424221951.GC18260@shareable.org>
Date: Fri, 24 Apr 2009 23:19:51 +0100
From: Jamie Lokier <jamie@...reable.org>
To: David VomLehn <dvomlehn@...co.com>
Cc: Alan Stern <stern@...land.harvard.edu>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Ingo Molnar <mingo@...e.hu>,
Arjan van de Ven <arjan@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux USB Mailing List <linux-usb@...r.kernel.org>,
Linux Embedded Mailing List <linux-embedded@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: Wait for console to become available, v3.2
David VomLehn wrote:
> > This looks like a good plan and not hard to implement. It even should
> > be possible to fit USB disk drives into the scheme.
>
> That would definitely rock.
How about this, perhaps in the generic device model:
1. Whenever a device's existence is detected by its parent bus,
add the device id to a pool of "potential devices worth waiting for".
2. Whenever a device is registered, remove that device id from the pool.
3. Whenever a device is itself a bus, or has subdevices or
attributes to be discovered, it triggers step 1 for all devices
found by enumeration (or in the case of USB, whatever you have to
wait for). Then the bus can declare itself initialised.
4. The top-level enumeration behaves as though there was a root bus,
onto which the real buses like PCI etc. are attached as in step 3.
5. Waiting for console / boot device / userspace waiting for other
mount points all check this pool for device ids of matching type.
In this, the pool serves the same role as Alan Stern's global counter,
the difference being you can wait for particular types of device when
you need to, and this is more explicit about how a hierarchy is handled.
Device ids in this pool are simply "category" values for what the
device is relevant to - and a waitqueue. If a PCI device is a serial
port, then goes into category "serial port", because it's relevant if
serial console is requested on the boot command line.
When waiting for a newly powered USB bus to settle, you may get
notification of all devices on it, but you might not know enough about
each device until the individual drivers start fetching descriptors.
Then you can either make every device go temporarily into the pool,
much as if it were a little bus itself, until it has detailed
information about what type of device it is. Or you can wait until
all those devices have fetched descriptors before the USB bus declares
that its enumeration is complete and removes its own id.
-- Jamie
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists