Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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()
  • Loading branch information
torvalds committed Dec 16, 2009
2 parents 61ecdb8 + d8bed5a commit 529e894
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 15 deletions.
44 changes: 34 additions & 10 deletions drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand All @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/base/power/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions include/linux/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ void prepare_namespace(void);

extern void (*late_time_init)(void);

extern int initcall_debug;

#endif

#ifndef MODULE
Expand Down

0 comments on commit 529e894

Please sign in to comment.