Hmm,I guess I might already understand the problem.
Consider such situation,during storage_probe,we set
timeout_handler,and we submit an urb, then we go to sleep.If time out
occurs,timeout_handler is called, at this moment, storage_probe should
still be in sleeping status, so timeout_handler couldn't go sleep,
otherwise the whole driver would not work any more.This can explain
the question I raised before.Thanks.

Regards
Jason

On 7/11/07, Oliver Neukum <[EMAIL PROTECTED]> wrote:
> Am Mittwoch, 11. Juli 2007 schrieb jidong xiao:
> > On 7/11/07, Oliver Neukum <[EMAIL PROTECTED]> wrote:
> > > Am Mittwoch, 11. Juli 2007 schrieb jidong xiao:
> > > > I see there are two routines, usb_unlink_urb and usb_kill_urb,the
> > > > latter one should be used for sync unlinking,this means it can go to
> > > > sleep,it won't return until the completion handler have finished.And
> > > > the former one could not go to sleep.But what's difference between
> > > > sync and async,I mean,why do we need such two kinds of mechanism to
> > > > cancel a transfer request?
> > >
> > > Under some conditions, eg. network drivers' and the storage driver's
> > > timeout handling, drivers cannot sleep. They have to stop transfers
> > > asynchronously.
> >
> > Ok,let's talk about the timeout handling routine,we defined a
> > timeout_handler in drivers/usb/storage/transport.c,inside that
> > function,we will call usb_unlink_urb,why cannot we sleep?what impact
> > if the driver go to sleep here?
>
> The handler is called with a spinlock held. If you sleep and another
> task tries to take the same lock, you will get a deadlock. This is the
> general reason for being unable to sleep in USB drivers.
>
>        Regards
>                Oliver
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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