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 power off. Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx> --- drivers/usb/core/port.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index b7388fd..5a7a833 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -2,6 +2,7 @@ #include <linux/errno.h> #include <linux/module.h> #include <linux/usb.h> +#include <linux/pm_qos.h> #include "usb.h" @@ -48,7 +49,7 @@ static const struct attribute_group *port_dev_group[] = { static void usb_port_device_release(struct device *dev) { struct usb_port *port_dev = to_usb_port(dev); - + dev_pm_qos_hide_flags(dev); usb_acpi_unregister_power_resources(dev); kfree(port_dev); } @@ -110,12 +111,19 @@ int usb_hub_create_port_device(struct device *intfdev, if (retval) goto error_register; + retval = dev_pm_qos_expose_flags(&port_dev->dev, + PM_QOS_FLAG_NO_POWER_OFF); + if (retval) + goto error_expose_pm_qos; + pm_runtime_set_active(&port_dev->dev); pm_runtime_enable(&port_dev->dev); usb_acpi_register_power_resources(&port_dev->dev); return 0; +error_expose_pm_qos: + device_del(&port_dev->dev); error_register: put_device(&port_dev->dev); return retval; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html