On Mon, 5 Jan 2004, Alan Stern wrote:
> The best way to prevent that from becoming a problem is for
> usb_disconnect() to insure the hub isn't on the event list to begin with.
> And the best way to insure _that_ is to unbind the hub driver.
In fact, this isn't such a big change as one might think. It doesn't even
require any special code, just a slight reorganization of
usb_disconnect(). Right now the routine does (in outline):
dev->state = NOTATTACHED;
down(&dev->serialize);
for each port
usb_disconnect(&dev->children[port]);
usb_disable_device(dev); // Does the unbind
free devnum bit
usbfs_remove_device(dev);
up(&dev->serialize);
device_unregister(&dev->dev);
The necessary changes are fairly small. Basically it changes the process
from a bottom-up to a pure top-down approach.
down(&dev->serialize);
dev->state = NOTATTACHED;
usb_disable_device(dev); // Does the unbind
usbfs_remove_device(dev);
free devnum bit
for each child of dev->dev
usb_disconnect(to_usbdev(child));
up(&dev->serialize);
device_unregister(&dev->dev);
Another advantage is that this way, when we reach the loop to handle the
children the only driver-model children of the device are usb_devices. If
we add a parent_port field to struct usb_device then the children[] array
wouldn't be needed at all!
Alan Stern
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel