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 19:16:07 schrieben Sie:
> > > > 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.
> 
> And there's the point of drivers using usb_claim_interface().
> Basically you should just kill them all.

If a driver uses usb_claim_interface() then it should also use 
usb_release_interface(), which will disable endpoints on the interface 
being released.  However the endpoints will be enabled again before 
usb_release_interface() returns, so there is a possibility that more
URBs could be submitted before the disconnect is finished.

I agree, it's overall cleaner for a driver to make sure it leaves no 
URBs active when it is disconnected.

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