Commit f6cced1a authored by Lan Tianyu's avatar Lan Tianyu Committed by Greg Kroah-Hartman

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarLan Tianyu <tianyu.lan@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ad493e5e
...@@ -67,6 +67,7 @@ static void usb_port_device_release(struct device *dev) ...@@ -67,6 +67,7 @@ static void usb_port_device_release(struct device *dev)
{ {
struct usb_port *port_dev = to_usb_port(dev); struct usb_port *port_dev = to_usb_port(dev);
dev_pm_qos_hide_flags(dev);
usb_acpi_unregister_power_resources(dev); usb_acpi_unregister_power_resources(dev);
kfree(port_dev); kfree(port_dev);
} }
...@@ -176,7 +177,15 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) ...@@ -176,7 +177,15 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1)
goto error_register; goto error_register;
pm_runtime_set_active(&port_dev->dev); pm_runtime_set_active(&port_dev->dev);
pm_runtime_enable(&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.
*/
if (!dev_pm_qos_expose_flags(&port_dev->dev,
PM_QOS_FLAG_NO_POWER_OFF))
pm_runtime_enable(&port_dev->dev);
retval = usb_acpi_register_power_resources(&port_dev->dev); retval = usb_acpi_register_power_resources(&port_dev->dev);
if (retval && retval != -ENODEV) if (retval && retval != -ENODEV)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment