On Tue, 23 May 2006, Franck Bui-Huu wrote:

> Franck Bui-Huu wrote:
> >     /* wait for the completion of the URB */
> > -   wait_for_completion(&urb_done);
> > -   clear_bit(US_FLIDX_URB_ACTIVE, &us->flags);
> > +   timeout = wait_for_completion_interruptible_timeout(
> > +                   &urb_done, timeout ? : MAX_SCHEDULE_TIMEOUT);
> >
> > -   /* clean up the timeout timer */
> > -   if (timeout > 0)
> > -           del_timer_sync(&to_timer);
> > +   if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags) && timeout <= 
> > 0) {
>
> Thinking more about it, I'm wondering it the second condition (timeout <= 0)
> is really needed. Do you think so ?

The test is needed because you shouldn't print a debugging message or
call usb_unlink_urb when the URB completes normally.  However you will
need to store the return value from
wait_for_completion_interruptible_timeout in a long instead of an int,
because MAX_SCHEDULE_TIMEOUT is defined as LONG_MAX.

On Tue, 23 May 2006, Oliver Neukum wrote:

> 1. You seem to have changed the semantics of the no timeout case. May you?

I don't see any changes in the semantics except for the _interruptible 
part.

> 2. You don't handle signals.

Signals aren't too much of an issue.  When this code runs in the context
of the usb-storage thread, all signals are masked.  It might also run in
the context of modprobe, however.  I don't know if a signal would need any
special handling; the fact that the URB was cancelled ought to be enough
to make the probe routine fail.  It wouldn't hurt to check...

Alan Stern



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to