Re: [PATCH v2 09/14] PM / Runtime: hold device active during device_wakeup_{enable|disable}

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

 



On 11/22/2013 10:08 AM, Dan Williams wrote:
usbcore blocks powering off hub ports while a downstream source is
wakeup enabled.  Once wakeup is disabled usbcore can try again to turn
off the parent port.  Add a pm_runtime reference manipulation to retry a
port power down on disable, or pin the port active on enable.

Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>

Well, while this generally won't hurt, I'm not sure how it helps either, because device_(disable|enable)_wakeup() don't touch any hardware and (for now) they are only about wakeup from system suspend.

I have a plan to change that, but for now it's just about system wakeup.

---
  drivers/base/power/wakeup.c |    9 ++++++++-
  1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 2d56f4113ae7..f784804137e7 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -14,6 +14,7 @@
  #include <linux/suspend.h>
  #include <linux/seq_file.h>
  #include <linux/debugfs.h>
+#include <linux/pm_runtime.h>
  #include <trace/events/power.h>
#include "power.h"
@@ -335,10 +336,16 @@ EXPORT_SYMBOL_GPL(device_init_wakeup);
   */
  int device_set_wakeup_enable(struct device *dev, bool enable)
  {
+	int rc;
+
  	if (!dev || !dev->power.can_wakeup)
  		return -EINVAL;
- return enable ? device_wakeup_enable(dev) : device_wakeup_disable(dev);
+	pm_runtime_get_sync(dev);
+	rc = enable ? device_wakeup_enable(dev) : device_wakeup_disable(dev);
+	pm_runtime_put_sync(dev);

And you can use pm_runtime_put() here to make the function return earlier.

+
+	return rc;
  }
  EXPORT_SYMBOL_GPL(device_set_wakeup_enable);

Thanks,
Rafael

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