]> git.hungrycats.org Git - linux/commit
[PATCH] USB: Remove hub's children upon unbinding
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 14 Jul 2004 07:42:40 +0000 (00:42 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 14 Jul 2004 07:42:40 +0000 (00:42 -0700)
commit9b5310c61ee661a4eccfed6bfc6ca2af2ef3114e
treee963bb512ea99ed2d653d163a36d6cb872540cd7
parentbf02cab829a1c00a47d689205d032d19145be928
[PATCH] USB: Remove hub's children upon unbinding

This patch fixes a logical hole in the hub driver.  It's possible for the
driver to be unbound from a hub without physically unplugging the hub.
For example, writing 0 into the bConfigurationValue attribute file will
have this effect.  When this happens, we need to make sure that all the
child devices of the hub are logically disconnected and their ports
disabled.

That's what this patch does.  It's a little bit tricky because we can't
simply call usb_disconnect() from within the hub driver's disconnect()
routine.  While that routine is running it holds the usb bus writelock,
but usb_disconnect() would try to acquire it again.  Instead
schedule_work() is used, so after a brief delay the children will be
removed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/usb/core/hub.c