diff options
author | Lan Tianyu <tianyu.lan@intel.com> | 2013-01-22 15:26:31 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-25 13:14:20 -0500 |
commit | f6cced1a08b475c5ac946823bb057714be7af4f6 (patch) | |
tree | 68a5d9b213296d772cbc6ff1aaccf4cb3289a894 /drivers/usb | |
parent | ad493e5e580546e6c3024b76a41535476da1546a (diff) |
usb: expose usb port's pm qos flags to user space
This patch is to expose usb port's pm qos flags(pm_qos_no_power_off,
pm_qos_remote_wakeup) to user space. User can set pm_qos_no_power_off
flag to prohibit the port from being powered off.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/port.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 280433d80887..9a15b26944ec 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c | |||
@@ -67,6 +67,7 @@ static void usb_port_device_release(struct device *dev) | |||
67 | { | 67 | { |
68 | struct usb_port *port_dev = to_usb_port(dev); | 68 | struct usb_port *port_dev = to_usb_port(dev); |
69 | 69 | ||
70 | dev_pm_qos_hide_flags(dev); | ||
70 | usb_acpi_unregister_power_resources(dev); | 71 | usb_acpi_unregister_power_resources(dev); |
71 | kfree(port_dev); | 72 | kfree(port_dev); |
72 | } | 73 | } |
@@ -176,7 +177,15 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) | |||
176 | goto error_register; | 177 | goto error_register; |
177 | 178 | ||
178 | pm_runtime_set_active(&port_dev->dev); | 179 | pm_runtime_set_active(&port_dev->dev); |
179 | pm_runtime_enable(&port_dev->dev); | 180 | |
181 | /* It would be dangerous if user space couldn't | ||
182 | * prevent usb device from being powered off. So don't | ||
183 | * enable port runtime pm if failed to expose port's pm qos. | ||
184 | */ | ||
185 | if (!dev_pm_qos_expose_flags(&port_dev->dev, | ||
186 | PM_QOS_FLAG_NO_POWER_OFF)) | ||
187 | pm_runtime_enable(&port_dev->dev); | ||
188 | |||
180 | 189 | ||
181 | retval = usb_acpi_register_power_resources(&port_dev->dev); | 190 | retval = usb_acpi_register_power_resources(&port_dev->dev); |
182 | if (retval && retval != -ENODEV) | 191 | if (retval && retval != -ENODEV) |