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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 update it's interface. Without this
change, if device autosuspends and the kernel polling for block
devices is disabled through sysfs at runtime or through bootargs, then
storage devices might never unmount since the disconnect IRQ wont be
kicked at all.

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

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 371a07d874a3..54a9accf88cb 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1305,6 +1305,11 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
 	if (iface->unregistering)
 		return -ENODEV;
 
+	/*Letting runtime PM know 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

--
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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux