Am Sonntag, 10. August 2003 19:45 schrieb David Brownell:
> Oliver Neukum wrote:
> >>For the urb to complete.  The schedule_timeout() returned without
> >>that completion.  We only forced the completion path to start, with
> >>the unlink; if it wasn't already starting (maybe on another CPU).
> > 
> > 
> > So you are doing the conventional wait stuff only to implement
> > the timeout, aren't you?
> 
> Not entirely.  USB drivers often don't use TASK_INTERRUPTIBLE
> when they should.  You'll notice that this routine is easy to
> modify so that it allows both timeouts and waits ... delete two
> letters to make it INTERRUPTIBLE.  It's only cleaning up after
> premature termination (timeout, or interrupt) that _needs_ to
> be UN-interruptible.

And several other code paths where we can't deal with failure,
like reset, setting addresses and others.

> That is, given that this logic works correctly (it did when I
> tested it), this logic can also be the core of a synchronous
> usbcore call that provides driver developers a flexibility
> they should have had all along:  users can ^C out of driver
> waits, processes can be kicked out of 'D' wait.
> 
> 
> > This seems kind of convoluted to me. May I suggest doing the
> > timeout explicitely like this:
> 
> That is, use a timer with a struct completion (and a random
> un-necessary flag), and cancel the urb in the timer function?
> 
> That's simpler, and would work on 2.4 too ... but it doesn't
> provide flexibility about exiting because of interrupt.

True, but is that relevant for 2.6 even?
It would need a change of API to use this. What concerns me about
your patch is that you use struct completion not as an opaque data
structure which some operations are defined for but as a public
data structure. The problem with that is that the implementation may
change. Eg. when you look at the code of complete() you'll see that
it uses primitives under a spinlock so I am not sure whether using
the usual primitives is safe at all.

        Regards
                Oliver



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to