So, I was sitting here, slamming down large amounts of caffine, and I
suddenly realized that my code might be full of race conditions which are
caused by the behavior of probes, disconnects, and suspends.
So, I think I need to ask some questions of the HCD gurus. Here they are,
in no particular order. When answering these, please keep in mind that
some people have multiple host controllers, possibly of multiple types.
(1) Are probing functions required to be re-entrant?
(2) Are disconnect functions required to be re-entrant?
(3) What happens if a probe or disconnect function blocks for a little
while while waiting to acquire a lock?
(4) What happens during a suspend? Are all devices disconnected and then
re-connected? If not, what happens if the system is suspended,
devices are added/removed, and then the system resumes?
(5) Once I return from a call to usb_deregister(), can I be _assured_ that
my probe and disconnect functions will never be called again?
(6) What happens if, while my probe function is attempting to communicate
with a device, the device is removed?
(6a) More pathologically, what happens in the above case if a new device
is inserted? Can the new device get the address of the old one? I
imagine that structure pointers will all be invalid at this point,
but are we really sure that this is the case? Also, how do I realize
that these pointers are invalid so I can abort probing as early as
possible? Or can I rely on the structures being there at least until
I return from my probe routine?
I think that's about it. Naturally, it would be really nice if
probing/disconnecting was serialized by the HCDs, but if that's not the
case, then I can deal with it. It would also be nice if, in the case of
6a, the interface structures remained valid until the probe routine
returned -- that way I could just issue my requests and have the HCD
fail them without having to worry.
Matt Dharm
--
Matthew Dharm Home: [EMAIL PROTECTED]
Engineer, Qualcomm, Inc. Work: [EMAIL PROTECTED]
S: Another stupid question?
G: There's no such thing as a stupid question, only stupid people.
-- Stef and Greg
User Friendly, 7/15/1998
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]