diff options
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/hub.c | 12 | ||||
-rw-r--r-- | drivers/usb/core/hub.h | 1 | ||||
-rw-r--r-- | drivers/usb/core/port.c | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 726fa07..5f43c22 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1276,12 +1276,22 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type) flush_work(&hub->tt.clear_work); } +static void hub_pm_barrier_for_all_ports(struct usb_hub *hub) +{ + int i; + + for (i = 0; i < hub->hdev->maxchild; ++i) + pm_runtime_barrier(&hub->ports[i]->dev); +} + /* caller has locked the hub device */ static int hub_pre_reset(struct usb_interface *intf) { struct usb_hub *hub = usb_get_intfdata(intf); hub_quiesce(hub, HUB_PRE_RESET); + hub->in_reset = 1; + hub_pm_barrier_for_all_ports(hub); return 0; } @@ -1290,6 +1300,8 @@ static int hub_post_reset(struct usb_interface *intf) { struct usb_hub *hub = usb_get_intfdata(intf); + hub->in_reset = 0; + hub_pm_barrier_for_all_ports(hub); hub_activate(hub, HUB_POST_RESET); return 0; } diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 33bcb2c..f9b521e 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -66,6 +66,7 @@ struct usb_hub { unsigned limited_power:1; unsigned quiescing:1; unsigned disconnected:1; + unsigned in_reset:1; unsigned quirk_check_port_auto_suspend:1; diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 51542f8..37647e0 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -81,6 +81,10 @@ static int usb_port_runtime_resume(struct device *dev) if (!hub) return -EINVAL; + if (hub->in_reset) { + port_dev->power_is_on = 1; + return 0; + } usb_autopm_get_interface(intf); set_bit(port1, hub->busy_bits); @@ -117,6 +121,8 @@ static int usb_port_runtime_suspend(struct device *dev) if (!hub) return -EINVAL; + if (hub->in_reset) + return -EBUSY; if (dev_pm_qos_flags(&port_dev->dev, PM_QOS_FLAG_NO_POWER_OFF) == PM_QOS_FLAGS_ALL) |