aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 15:03:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 15:03:03 -0500
commit529e89430d6c0d64db8ac474cb95e68e2527c79a (patch)
tree0407825d29351d04474b3a1294f2b4d42a1e8e03
parent61ecdb84c1f05ad445db4584ae375a15c0e8ae47 (diff)
parentd8bed5a4f343d1826153ecf8e7932126c757a21d (diff)
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.c44
-rw-r--r--drivers/base/power/runtime.c10
-rw-r--r--include/linux/init.h2
3 files changed, 41 insertions, 15 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 8aa2443182d5..1a216c114a0f 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -23,8 +23,8 @@
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/pm_runtime.h> 24#include <linux/pm_runtime.h>
25#include <linux/resume-trace.h> 25#include <linux/resume-trace.h>
26#include <linux/rwsem.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/sched.h>
28 28
29#include "../base.h" 29#include "../base.h"
30#include "power.h" 30#include "power.h"
@@ -172,6 +172,13 @@ static int pm_op(struct device *dev,
172 pm_message_t state) 172 pm_message_t state)
173{ 173{
174 int error = 0; 174 int error = 0;
175 ktime_t calltime, delta, rettime;
176
177 if (initcall_debug) {
178 pr_info("calling %s+ @ %i\n",
179 dev_name(dev), task_pid_nr(current));
180 calltime = ktime_get();
181 }
175 182
176 switch (state.event) { 183 switch (state.event) {
177#ifdef CONFIG_SUSPEND 184#ifdef CONFIG_SUSPEND
@@ -219,6 +226,14 @@ static int pm_op(struct device *dev,
219 default: 226 default:
220 error = -EINVAL; 227 error = -EINVAL;
221 } 228 }
229
230 if (initcall_debug) {
231 rettime = ktime_get();
232 delta = ktime_sub(rettime, calltime);
233 pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev),
234 error, (unsigned long long)ktime_to_ns(delta) >> 10);
235 }
236
222 return error; 237 return error;
223} 238}
224 239
@@ -236,6 +251,13 @@ static int pm_noirq_op(struct device *dev,
236 pm_message_t state) 251 pm_message_t state)
237{ 252{
238 int error = 0; 253 int error = 0;
254 ktime_t calltime, delta, rettime;
255
256 if (initcall_debug) {
257 pr_info("calling %s_i+ @ %i\n",
258 dev_name(dev), task_pid_nr(current));
259 calltime = ktime_get();
260 }
239 261
240 switch (state.event) { 262 switch (state.event) {
241#ifdef CONFIG_SUSPEND 263#ifdef CONFIG_SUSPEND
@@ -283,6 +305,14 @@ static int pm_noirq_op(struct device *dev,
283 default: 305 default:
284 error = -EINVAL; 306 error = -EINVAL;
285 } 307 }
308
309 if (initcall_debug) {
310 rettime = ktime_get();
311 delta = ktime_sub(rettime, calltime);
312 printk("initcall %s_i+ returned %d after %Ld usecs\n", dev_name(dev),
313 error, (unsigned long long)ktime_to_ns(delta) >> 10);
314 }
315
286 return error; 316 return error;
287} 317}
288 318
@@ -341,14 +371,11 @@ static int device_resume_noirq(struct device *dev, pm_message_t state)
341 TRACE_DEVICE(dev); 371 TRACE_DEVICE(dev);
342 TRACE_RESUME(0); 372 TRACE_RESUME(0);
343 373
344 if (!dev->bus) 374 if (dev->bus && dev->bus->pm) {
345 goto End;
346
347 if (dev->bus->pm) {
348 pm_dev_dbg(dev, state, "EARLY "); 375 pm_dev_dbg(dev, state, "EARLY ");
349 error = pm_noirq_op(dev, dev->bus->pm, state); 376 error = pm_noirq_op(dev, dev->bus->pm, state);
350 } 377 }
351 End: 378
352 TRACE_RESUME(error); 379 TRACE_RESUME(error);
353 return error; 380 return error;
354} 381}
@@ -584,10 +611,7 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state)
584{ 611{
585 int error = 0; 612 int error = 0;
586 613
587 if (!dev->bus) 614 if (dev->bus && dev->bus->pm) {
588 return 0;
589
590 if (dev->bus->pm) {
591 pm_dev_dbg(dev, state, "LATE "); 615 pm_dev_dbg(dev, state, "LATE ");
592 error = pm_noirq_op(dev, dev->bus->pm, state); 616 error = pm_noirq_op(dev, dev->bus->pm, state);
593 } 617 }
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 5a01ecef4af3..40d7720a4b21 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -701,15 +701,15 @@ EXPORT_SYMBOL_GPL(pm_request_resume);
701 * @dev: Device to handle. 701 * @dev: Device to handle.
702 * @sync: If set and the device is suspended, resume it synchronously. 702 * @sync: If set and the device is suspended, resume it synchronously.
703 * 703 *
704 * Increment the usage count of the device and if it was zero previously, 704 * Increment the usage count of the device and resume it or submit a resume
705 * resume it or submit a resume request for it, depending on the value of @sync. 705 * request for it, depending on the value of @sync.
706 */ 706 */
707int __pm_runtime_get(struct device *dev, bool sync) 707int __pm_runtime_get(struct device *dev, bool sync)
708{ 708{
709 int retval = 1; 709 int retval;
710 710
711 if (atomic_add_return(1, &dev->power.usage_count) == 1) 711 atomic_inc(&dev->power.usage_count);
712 retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev); 712 retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
713 713
714 return retval; 714 return retval;
715} 715}
diff --git a/include/linux/init.h b/include/linux/init.h
index ff8bde520d03..ab1d31f9352b 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -149,6 +149,8 @@ void prepare_namespace(void);
149 149
150extern void (*late_time_init)(void); 150extern void (*late_time_init)(void);
151 151
152extern int initcall_debug;
153
152#endif 154#endif
153 155
154#ifndef MODULE 156#ifndef MODULE