[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1392913425-29369-2-git-send-email-a.perevalov@samsung.com>
Date: Thu, 20 Feb 2014 20:23:40 +0400
From: Alexey Perevalov <a.perevalov@...sung.com>
To: linux-kernel@...r.kernel.org, tglx@...utronix.de,
john.stultz@...aro.org
Cc: Alexey Perevalov <a.perevalov@...sung.com>, anton@...msg.org,
kyungmin.park@...sung.com, cw00.choi@...sung.com,
akpm@...ux-foundation.org
Subject: [PATCH v4 1/6] Replace ternary operator to macro
For extensibility purpose it's better to have _switch_ type mechanism
for representing human readable CLOCKID* and HRMODE.
Signed-off-by: Alexey Perevalov <a.perevalov@...sung.com>
---
include/trace/events/timer.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
index 68c2c20..185b2c6 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -8,6 +8,16 @@
#include <linux/hrtimer.h>
#include <linux/timer.h>
+#define clockid_to_string(clockid) \
+ __print_symbolic(clockid, \
+ { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" }, \
+ { CLOCK_REALTIME, "CLOCK_REALTIME" })
+
+#define hrmode_to_string(hrmode) \
+ __print_symbolic(hrmode, \
+ { HRTIMER_MODE_ABS, "HRTIMER_MODE_ABS" }, \
+ { HRTIMER_MODE_REL, "HRTIMER_MODE_REL" })
+
DECLARE_EVENT_CLASS(timer_class,
TP_PROTO(struct timer_list *timer),
@@ -147,10 +157,8 @@ TRACE_EVENT(hrtimer_init,
),
TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
- __entry->clockid == CLOCK_REALTIME ?
- "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
- __entry->mode == HRTIMER_MODE_ABS ?
- "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
+ clockid_to_string(__entry->clockid),
+ hrmode_to_string(__entry->mode))
);
/**
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists