multiple interface test case

Roman Kagan rkagan at mail.ru
Wed Apr 13 06:32:33 EDT 2005


On Wed, Apr 13, 2005 at 12:13:22PM +0200, Duncan Sands wrote:
> Hi Roman, in -mm things are completely different.  Here's what
> happens: driver_detach correctly iterates over the devices.
> 
> First device (interface 0):
> 	device_release_driver calls usb_unbind_interface which calls
> test_usb_disconnect.  This calls usb_driver_release_interface on each
> interface:
> 	interface 0: instant exit at this line:
>       	  if (!dev->driver || dev->driver != &driver->driver)
>        	         return;

No, this test passes for all three interfaces.  dev->driver is set to
NULL later, in this routine or in device_release_driver()

> 	interfaces 1 and 2: device_release_driver is NOT called, because
> of this test:
>     	    if (!klist_node_attached(&dev->knode_driver) && !klist_node_attached(&dev->knode_bus)) {

On the opposite: this test fails for intf 0 (the one disconnect() was
called with), because device_release_driver() has already detached this
device from the driver, but passes for other interfaces (otherwise what
would be the reason for this test :).

> Second and third devices (interfaces 1 and 2):
> 	device_release_driver does an instant exit because of this test:
> 	         if (dev->driver) {

No, because the device_release_driver() for these interfaces has already
been called from device_release_driver() for intf 0, the device list is
already empty and the iteration in driver_detach only reaches interface
1, does nothing because dev->driver is NULL, and then advances to itself
over and over.

> Summary: the fault seems to be in usb_driver_release_interface, which
> shouldn't be setting dev->driver to NULL.

Disagreed :)  This dev->driver = NULL is a noop: it is set to NULL
either in device_release_driver() which called us (when operating on the
disconnect()-ed interface), or in device_release_driver() which we call.

Roman.



More information about the Usbatm mailing list