diff options
author | Dan Williams <dan.j.williams@intel.com> | 2014-05-20 18:08:12 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-27 16:35:09 -0700 |
commit | 9262c19d14c433a6a1ba25c3ff897cb89e412309 (patch) | |
tree | 50f83b859b251a3e842953e4fb9619a05ece02da /drivers/usb/core/port.c | |
parent | 600856c231ccb0cbf8afcf09066a8ab2a93ab03d (diff) | |
download | linux-next-9262c19d14c433a6a1ba25c3ff897cb89e412309.tar.gz |
usb: disable port power control if not supported in wHubCharacteristics
A hub indicates whether it supports per-port power control via the
wHubCharacteristics field in its descriptor. If it is not supported
a hub will still emulate ClearPortPower(PORT_POWER) requests by
stopping the link state machine. However, since this does not save
power do not bother suspending.
This also consolidates support checks into a
hub_is_port_power_switchable() helper.
Acked-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>
Diffstat (limited to 'drivers/usb/core/port.c')
-rw-r--r-- | drivers/usb/core/port.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 37647e080599..168fa6ee3348 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -177,12 +177,15 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) pm_runtime_set_active(&port_dev->dev); - /* It would be dangerous if user space couldn't - * prevent usb device from being powered off. So don't - * enable port runtime pm if failed to expose port's pm qos. + /* + * Do not enable port runtime pm if the hub does not support + * power switching. Also, userspace must have final say of + * whether a port is permitted to power-off. Do not enable + * runtime pm if we fail to expose pm_qos_no_power_off. */ - if (!dev_pm_qos_expose_flags(&port_dev->dev, - PM_QOS_FLAG_NO_POWER_OFF)) + if (hub_is_port_power_switchable(hub) + && dev_pm_qos_expose_flags(&port_dev->dev, + PM_QOS_FLAG_NO_POWER_OFF) == 0) pm_runtime_enable(&port_dev->dev); device_enable_async_suspend(&port_dev->dev); |