On Thu, 1 May 2014, Dan Williams wrote:

> I've been testing this and the pm_request_resume() ends up leaving the
> usb device enabled indefinitely.  It needs to be paired with a
> pm_runtime_autosuspend(), but at that point why not just add a
> usb_autoresume_device_async() helper.

Why didn't pm_request_resume() result in an autosuspend?  I just tested
this patch on my system:


Index: usb-3.15/drivers/usb/core/sysfs.c
===================================================================
--- usb-3.15.orig/drivers/usb/core/sysfs.c
+++ usb-3.15/drivers/usb/core/sysfs.c
@@ -11,6 +11,7 @@
 
 
 #include <linux/kernel.h>
+#include <linux/pm_runtime.h>
 #include <linux/string.h>
 #include <linux/usb.h>
 #include <linux/usb/quirks.h>
@@ -55,6 +56,8 @@ static ssize_t bMaxPower_show(struct dev
        if (actconfig)
                rc = sprintf(buf, "%dmA\n", usb_get_max_power(udev, actconfig));
        usb_unlock_device(udev);
+       dev_info(dev, "calling request_resume\n");
+       pm_request_resume(dev);
        return rc;
 }
 static DEVICE_ATTR_RO(bMaxPower);


With no USB devices plugged into bus 1 and the root hub suspended, 
doing "cat /sys/bus/usb/devices/usb1/bMaxPower" caused the root hub to 
resume and suspend again shortly thereafter.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to