USB: EHCI: don't depend on hardware for tracking port resets and resumes
In theory, an EHCI controller can turn off the PORT_RESUME or PORT_RESET bits in a port status register all by itself (and some controllers actually do this). We shouldn't depend on these bits being set correctly. This patch rearranges the code in ehci-hcd that handles completion of port resets and resumes. We guarantee that ehci->reset_done[portnum] is nonzero if a reset or resume is in progress, and that the portnum bit is set in ehci->resuming_ports if the operation is a resume. (To help enforce this guarantee, the patch prevents suspended ports from being reset.) Therefore it's not necessary to look at the port status bits to learn what's going on. The patch looks bigger than it really is, because it changes the indentation level of a sizeable region of code. Most of what it actually does is interchange some tests. The only functional changes are testing reset_done and resuming_ports rather than PORT_RESUME and PORT_RESET, removing a now-unnecessary check for spontaneous resets of the PORT_RESUME and PORT_RESET bits, and preventing a suspended or resuming port from being reset. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing
Please register or sign in to comment