[PATCH] USB :core :Prevent USB devices to autosuspend while setting interface

From: Abhijeet
Date: Fri Nov 10 2017 - 07:43:01 EST


From: abhijeet kumar <abhijeet.kumar@xxxxxxxxx>

Runtime resume USB device in order to ensure that PM framework
knows that the we might be using the device in a short time and doesn't
autosuspend the device while we updating it's interface.

Signed-off-by: abhijeet kumar <abhijeet.kumar@xxxxxxxxx>
---
drivers/usb/core/message.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 371a07d874a3..658603ed779e 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1305,6 +1305,9 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
if (iface->unregistering)
return -ENODEV;

+ /*Letting runtime PM now that we wish to use the device in a short time
+ *pm_runtime_get(&iface->dev);
+ */
+
alt = usb_altnum_to_altsetting(iface, alternate);
if (!alt) {
dev_warn(&dev->dev, "selecting invalid altsetting %d\n",
--
1.9.1