diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 12:03:03 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 12:03:03 -0800 |
commit | 529e89430d6c0d64db8ac474cb95e68e2527c79a (patch) | |
tree | 0407825d29351d04474b3a1294f2b4d42a1e8e03 | |
parent | 61ecdb84c1f05ad445db4584ae375a15c0e8ae47 (diff) | |
parent | d8bed5a4f343d1826153ecf8e7932126c757a21d (diff) | |
download | op-kernel-dev-529e89430d6c0d64db8ac474cb95e68e2527c79a.zip op-kernel-dev-529e89430d6c0d64db8ac474cb95e68e2527c79a.tar.gz |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
PM: rwsem.h need not be included into main.c
PM: Remove unnecessary goto from device_resume_noirq()
PM: Add initcall_debug style timing for suspend/resume
PM: allow for usage_count > 0 in pm_runtime_get()
-rw-r--r-- | drivers/base/power/main.c | 44 | ||||
-rw-r--r-- | drivers/base/power/runtime.c | 10 | ||||
-rw-r--r-- | include/linux/init.h | 2 |
3 files changed, 41 insertions, 15 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 8aa2443..1a216c1 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -23,8 +23,8 @@ #include <linux/pm.h> #include <linux/pm_runtime.h> #include <linux/resume-trace.h> -#include <linux/rwsem.h> #include <linux/interrupt.h> +#include <linux/sched.h> #include "../base.h" #include "power.h" @@ -172,6 +172,13 @@ static int pm_op(struct device *dev, pm_message_t state) { int error = 0; + ktime_t calltime, delta, rettime; + + if (initcall_debug) { + pr_info("calling %s+ @ %i\n", + dev_name(dev), task_pid_nr(current)); + calltime = ktime_get(); + } switch (state.event) { #ifdef CONFIG_SUSPEND @@ -219,6 +226,14 @@ static int pm_op(struct device *dev, default: error = -EINVAL; } + + if (initcall_debug) { + rettime = ktime_get(); + delta = ktime_sub(rettime, calltime); + pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev), + error, (unsigned long long)ktime_to_ns(delta) >> 10); + } + return error; } @@ -236,6 +251,13 @@ static int pm_noirq_op(struct device *dev, pm_message_t state) { int error = 0; + ktime_t calltime, delta, rettime; + + if (initcall_debug) { + pr_info("calling %s_i+ @ %i\n", + dev_name(dev), task_pid_nr(current)); + calltime = ktime_get(); + } switch (state.event) { #ifdef CONFIG_SUSPEND @@ -283,6 +305,14 @@ static int pm_noirq_op(struct device *dev, default: error = -EINVAL; } + + if (initcall_debug) { + rettime = ktime_get(); + delta = ktime_sub(rettime, calltime); + printk("initcall %s_i+ returned %d after %Ld usecs\n", dev_name(dev), + error, (unsigned long long)ktime_to_ns(delta) >> 10); + } + return error; } @@ -341,14 +371,11 @@ static int device_resume_noirq(struct device *dev, pm_message_t state) TRACE_DEVICE(dev); TRACE_RESUME(0); - if (!dev->bus) - goto End; - - if (dev->bus->pm) { + if (dev->bus && dev->bus->pm) { pm_dev_dbg(dev, state, "EARLY "); error = pm_noirq_op(dev, dev->bus->pm, state); } - End: + TRACE_RESUME(error); return error; } @@ -584,10 +611,7 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state) { int error = 0; - if (!dev->bus) - return 0; - - if (dev->bus->pm) { + if (dev->bus && dev->bus->pm) { pm_dev_dbg(dev, state, "LATE "); error = pm_noirq_op(dev, dev->bus->pm, state); } diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 5a01ece..40d7720 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -701,15 +701,15 @@ EXPORT_SYMBOL_GPL(pm_request_resume); * @dev: Device to handle. * @sync: If set and the device is suspended, resume it synchronously. * - * Increment the usage count of the device and if it was zero previously, - * resume it or submit a resume request for it, depending on the value of @sync. + * Increment the usage count of the device and resume it or submit a resume + * request for it, depending on the value of @sync. */ int __pm_runtime_get(struct device *dev, bool sync) { - int retval = 1; + int retval; - if (atomic_add_return(1, &dev->power.usage_count) == 1) - retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev); + atomic_inc(&dev->power.usage_count); + retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev); return retval; } diff --git a/include/linux/init.h b/include/linux/init.h index ff8bde5..ab1d31f 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -149,6 +149,8 @@ void prepare_namespace(void); extern void (*late_time_init)(void); +extern int initcall_debug; + #endif #ifndef MODULE |