From akpm@osdl.org Mon Apr 11 16:44:57 2005 Subject: usb: klist_node_attached() fix To: greg@kroah.com Cc: akpm@osdl.org, mochel@digitalimplant.org From: akpm@osdl.org Content-Length: 1545 Lines: 40 From: Patrick Mochel The original code looks like this: /* if interface was already added, bind now; else let * the future device_add() bind it, bypassing probe() */ if (!list_empty (&dev->bus_list)) device_bind_driver(dev); IOW, it's checking to see if the device is attached to the bus or not and binding the driver if it is. It's checking the device's bus list, which will only appear empty when the device has been initialized, but not added. It depends way too much on the driver model internals, but it seems to be the only way to do the weird crap they want to do with interfaces. When I converted it to use klists, I accidentally inverted the logic, which led to bad things happening. This patch returns the check to its orginal value. From: Patrick Mochel Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Index: gregkh-2.6/drivers/usb/core/usb.c =================================================================== --- gregkh-2.6.orig/drivers/usb/core/usb.c 2005-04-20 21:38:28.000000000 -0700 +++ gregkh-2.6/drivers/usb/core/usb.c 2005-04-20 21:43:00.000000000 -0700 @@ -293,7 +293,7 @@ /* if interface was already added, bind now; else let * the future device_add() bind it, bypassing probe() */ - if (!klist_node_attached (&dev->knode_bus)) + if (klist_node_attached(&dev->knode_bus)) device_bind_driver(dev); return 0;