[PATCH 1/2] PM / Runtime: add conditional trace macro

From: Vincent Palatin
Date: Fri Sep 16 2011 - 18:16:29 EST


Add a new "dev_printk_norpm" macro which prints the trace only when the
device has not the runtime PM activated.
Some traces (e.g. PCI configuration) are useful in default mode but when
the runtime PM is activated, they become very noisy if the device is
often enabled/disabled.

If needed, CONFIG_PM_VERBOSE will re-activate all the original traces.

Signed-off-by: Vincent Palatin <vpalatin@xxxxxxxxxxxx>
---
include/linux/pm_runtime.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index daac05d..57da18c 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -22,6 +22,18 @@
usage_count */
#define RPM_AUTO 0x08 /* Use autosuspend_delay */

+/* print trace only if the runtime PM is not activated on the device */
+#ifdef CONFIG_PM_VERBOSE
+#define dev_printk_norpm(level, dev, format, ...) \
+ dev_printk(level, dev, format, ##__VA_ARGS__);
+#else
+#define dev_printk_norpm(level, dev, format, ...) \
+({ \
+ if (!pm_runtime_enabled(dev)) \
+ dev_printk(level, dev, format, ##__VA_ARGS__); \
+})
+#endif
+
#ifdef CONFIG_PM_RUNTIME

extern struct workqueue_struct *pm_wq;
--
1.7.3.1

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