{
struct usb_port *port_dev = to_usb_port(dev);
+ dev_pm_qos_hide_flags(dev);
usb_acpi_unregister_power_resources(dev);
kfree(port_dev);
}
goto error_register;
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);
if (retval && retval != -ENODEV)