[PATCH] USB: Genuine changes to hub_port_debounce()
This patch includes the algorithmic changes I would like to see in hub_port_debounce(). They are: Increase the total timeout period from 400 ms to 1500 ms. Check the port's connect-changed status during the polling loop. Return as soon as the connection has been stable for the required time, even if it has been stably _dis_-connected. (The current code waits for the full timeout period if there isn't a connection.) In previous emails I have responded to all the concerns raised by others about these changes, and I can't imagine how they could cause any trouble. Increasing the total timeout won't affect people with properly functioning hardware. Their connections will quickly stabilize and the routine will return just as before. People with flaky hardware that takes a long time to settle down will now be able to use their devices. Checking the connect-changed status during the polling loop will make the test more conservative. The code will be able to detect transient disconnections that it would have missed before, and it won't return until the connection really _is_ stable. Furthermore, this makes the test compliant with the USB specification, which requires the stability timer to be restarted whenever a connection change occurs. Returning early for disconnections is a simple optimization. It's more important now that the total timeout length is 1.5 seconds rather than 0.4 seconds. I urge you to apply this patch and for people to try it out. If there do turn out to be problems... the patch is very small, well-contained, and easy to revert. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Showing
Please register or sign in to comment