[PATCH v1 2/2] PM/runtime: replace dev_dbg with trace_rpm_*

From: tom . leiming
Date: Tue Sep 27 2011 - 06:13:51 EST


From: Ming Lei <ming.lei@xxxxxxxxxxxxx>

This patch replaces dev_dbg with trace_rpm_* inside
the three important functions:

rpm_idle
rpm_suspend
rpm_resume

Trace points have the below advantages compared with dev_dbg:

- trace points include much runtime information(such as
running cpu, current task, ...)

- most of linux distributions may disable "verbose debug"
driver debug compile switch, so it is very difficult to
report/debug runtime pm related problems from distribution
users without this kind of debug information.

- for upstream kernel users, enableing the debug switch will
produce many useless "rpm_resume" output, and it is very noise.

- dev_dbg inside rpm_suspend/rpm_resume may have some effects
on runtime pm behaviour of console devicer

Cc: Steven Rostedt rostedt@xxxxxxxxxxx
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxxxxx>
---

v1: takes Steven's suggestions
- pass _THIS_IP_ to trace_rpm_return_int

---
drivers/base/power/runtime.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index acb3f83..74013fa 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -9,6 +9,7 @@

#include <linux/sched.h>
#include <linux/pm_runtime.h>
+#include <trace/events/rpm.h>
#include "power.h"

static int rpm_resume(struct device *dev, int rpmflags);
@@ -171,6 +172,7 @@ static int rpm_idle(struct device *dev, int rpmflags)
int (*callback)(struct device *);
int retval;

+ trace_rpm_idle(dev, rpmflags);
retval = rpm_check_suspend_allowed(dev);
if (retval < 0)
; /* Conditions are wrong. */
@@ -243,6 +245,7 @@ static int rpm_idle(struct device *dev, int rpmflags)
wake_up_all(&dev->power.wait_queue);

out:
+ trace_rpm_return_int(dev, _THIS_IP_, retval);
return retval;
}

@@ -295,7 +298,7 @@ static int rpm_suspend(struct device *dev, int rpmflags)
struct device *parent = NULL;
int retval;

- dev_dbg(dev, "%s flags 0x%x\n", __func__, rpmflags);
+ trace_rpm_suspend(dev, rpmflags);

repeat:
retval = rpm_check_suspend_allowed(dev);
@@ -430,7 +433,7 @@ static int rpm_suspend(struct device *dev, int rpmflags)
}

out:
- dev_dbg(dev, "%s returns %d\n", __func__, retval);
+ trace_rpm_return_int(dev, _THIS_IP_, retval);

return retval;
}
@@ -459,7 +462,7 @@ static int rpm_resume(struct device *dev, int rpmflags)
struct device *parent = NULL;
int retval = 0;

- dev_dbg(dev, "%s flags 0x%x\n", __func__, rpmflags);
+ trace_rpm_resume(dev, rpmflags);

repeat:
if (dev->power.runtime_error)
@@ -615,7 +618,7 @@ static int rpm_resume(struct device *dev, int rpmflags)
spin_lock_irq(&dev->power.lock);
}

- dev_dbg(dev, "%s returns %d\n", __func__, retval);
+ trace_rpm_return_int(dev, _THIS_IP_, retval);

return retval;
}
--
1.7.5.4

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