Re: newbie question: usb_kill_urb necessary in disconnect?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 27 Jan 2010, Oliver Neukum wrote:

> Am Mittwoch, 27. Januar 2010 15:55:32 schrieb Alan Stern:
> > On Wed, 27 Jan 2010 mikedunn@xxxxxxxxxxx wrote:
> > 
> > > Hi,
> > > 
> > > Quick question that will save a lot of time slogging through usbcore code if
> > > someone will indulge me.
> > > 
> > > Is it necessary to kill all outstanding urbs in a driver's disconnect
> > > function?  I've seen documentation saying that the usbcore takes care of this
> > > when the disconnect is detected, suggesting that tracking outstanding urbs and
> > > killing them in the driver's disconnect function is unnecessary.  But I also
> > > see drivers that do just that.  As I understand it, an urb killed by usbcore
> > > will have its callback invoked, with the result code indicating that it was
> > > killed, which the callback can handle gracefully.  Any errors in my
> > > understanding?
> > 
> > That's basically right.  A driver doesn't have to kill its own URBs, 
> > but it is considered good form to do so.
> 
> Ehm, there's the small matter of disconnect by sysfs or usbfs.
> Or module unload.

The reason for calling the disconnect routine doesn't matter; the core 
first disables the interface's endpoints, meaning that pending URBs 
will fail with -ESHUTDOWN and new submissions will fail with -ENOENT.  
However URBs for endpoint 0 are unaffected -- the driver has to handle 
them on its own.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux