[RFC 1/5] pm, runtime, Add resume notifier

From: Huang Ying
Date: Mon Feb 06 2012 - 02:32:34 EST


Asynchronous interface is provided for runtime PM, when the requested
action (suspend/resume) is completed, the caller may need to be
notified.

Signed-off-by: Huang Ying <ying.huang@xxxxxxxxx>
---
drivers/base/power/runtime.c | 1 +
include/linux/pm.h | 2 ++
2 files changed, 3 insertions(+)

--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -733,6 +733,7 @@ static int rpm_resume(struct device *dev
atomic_inc(&parent->power.child_count);
}
wake_up_all(&dev->power.wait_queue);
+ atomic_notifier_call_chain(&dev->power.notifier, RPM_REQ_RESUME, dev);

if (!retval)
rpm_idle(dev, RPM_ASYNC);
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -27,6 +27,7 @@
#include <linux/wait.h>
#include <linux/timer.h>
#include <linux/completion.h>
+#include <linux/notifier.h>

/*
* Callbacks for platform drivers to implement.
@@ -488,6 +489,7 @@ struct dev_pm_info {
unsigned long timer_expires;
struct work_struct work;
wait_queue_head_t wait_queue;
+ struct atomic_notifier_head notifier;
atomic_t usage_count;
atomic_t child_count;
unsigned int disable_depth:3;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/