ChangeSet 1.2181.4.21, 2005/03/17 17:57:47-08:00, [EMAIL PROTECTED] [PATCH] USB: Prevent hub driver interference during port reset
This patch causes the hub driver to ignore ports that are being reset by another driver. Without this protection khubd will sometimes notice that the port is behaving funny while the reset is taking place and will unilaterally disconnect it, which is not what we want. Signed-off-by: Alan Stern <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> drivers/usb/core/hub.c | 4 ++++ drivers/usb/core/hub.h | 1 + 2 files changed, 5 insertions(+) diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c --- a/drivers/usb/core/hub.c 2005-03-30 13:38:32 -08:00 +++ b/drivers/usb/core/hub.c 2005-03-30 13:38:32 -08:00 @@ -2644,6 +2644,8 @@ /* deal with port status changes */ for (i = 1; i <= hub->descriptor->bNbrPorts; i++) { + if (test_bit(i, hub->busy_bits)) + continue; connect_change = test_bit(i, hub->change_bits); if (!test_and_clear_bit(i, hub->event_bits) && !connect_change && !hub->activating) @@ -2949,6 +2951,7 @@ hub_pre_reset(hub); } + set_bit(port1, parent_hub->busy_bits); for (i = 0; i < SET_CONFIG_TRIES; ++i) { /* ep0 maxpacket size may change; let the HCD know about it. @@ -2958,6 +2961,7 @@ if (ret >= 0) break; } + clear_bit(port1, parent_hub->busy_bits); if (ret < 0) goto re_enumerate; diff -Nru a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h --- a/drivers/usb/core/hub.h 2005-03-30 13:38:32 -08:00 +++ b/drivers/usb/core/hub.h 2005-03-30 13:38:32 -08:00 @@ -205,6 +205,7 @@ unsigned long event_bits[1]; /* status change bitmask */ unsigned long change_bits[1]; /* ports with logical connect status change */ + unsigned long busy_bits[1]; /* ports being reset */ #if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */ #error event_bits[] is too short! #endif ------------------------------------------------------- This SF.net email is sponsored by Demarc: A global provider of Threat Management Solutions. Download our HomeAdmin security software for free today! http://www.demarc.com/info/Sentarus/hamr30 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel