From: "Greg KH" <[EMAIL PROTECTED]>
> But David's right, this needs to be fixed differently, and I'll work on
> adding proper disconnect logic.  I'm already starting to work on a
> number of cleanups that these drivers need (proper device model changes,
> code splitup, etc.)

But I could use it fixed right now, so...  what I've figured out is
that close needs a way to tell when the device is in disconnected
state (easy, _disconnect sets a flag), and needs a way to tell when
its the last close for that device. Not terribly easy, unless...  what
about having a per-"struct usb_serial" open count that _open could
maintain alongside the per-port counts? Then when that drops to 0, and
FLAG_DISC, then free the memory?

Or, have close() check the sum of the per-port counters...  but that
takes processing time on each close.

All other serial_() calls would be changed to mimic close(), use the
driver_data as the basis for the port struct, but once the semaphore
is acquired, re-check driver_data.

Hmmm. Actually there's still a race. _disconnect(), then all the
close()s, including the last one that frees memory, then write() gets
to run and we have the missing semaphore problem again. Unless
semaphores have an ordering guarantee about sleeping and waking?

..Stu




-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to