On Mon, 12 Feb 2007, Oliver Neukum wrote:

> Hi,
> 
> concerning this code from usb_suspend_interface(), what keeps "driver"
> valid? I can see pm_lock protecting against usb_claim_interface(), but
> what about driver (un)registration?
> 
>       driver = to_usb_driver(intf->dev.driver);
> 
>       if (driver->suspend && driver->resume) {
>               status = driver->suspend(intf, msg);

There are two ways a driver can be unbound from an interface.  The usual 
way is to unregister the driver, which would call through 
driver.c:usb_unbind_interface(), which calls usb_autoresume_device().  
That would force it to wait until usb_suspend_interface() finished.

The other way is to call usb_driver_release_interface().  I assumed this
would happen only as part of unregistering the driver.  If it occurs at
some other time then "driver" might indeed be NULL.  It wouldn't be hard 
to add synchronization, if you really think it is needed.

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