USB: mutual exclusion for resetting a hub and power-managing a port
commit600856c231ccb0cbf8afcf09066a8ab2a93ab03d
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 21 May 2014 01:08:07 +0000 (20 18:08 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 May 2014 23:28:03 +0000 (27 16:28 -0700)
treeaa8e9074adccb30ecbd6ac8aa2dce377e0c5a834
parent342a74934197386e065e8ef00014e6f0cb5effe6
USB: mutual exclusion for resetting a hub and power-managing a port

The USB core doesn't properly handle mutual exclusion between
resetting a hub and changing the power states of the hub's ports.  We
need to avoid sending port-power requests to the hub while it is being
reset, because such requests cannot succeed.

This patch fixes the problem by keeping track of when a reset is in
progress.  At such times, attempts to suspend (power-off) a port will
fail immediately with -EBUSY, and calls to usb_port_runtime_resume()
will update the power_is_on flag and return immediately.  When the
reset is complete, hub_activate() will automatically restore each port
to the proper power state.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hub.c
drivers/usb/core/hub.h
drivers/usb/core/port.c