ftrace: Make FTRACE_WARN_ON() work in if condition
authorSteven Rostedt <srostedt@redhat.com>
Fri, 29 Apr 2011 14:36:31 +0000 (10:36 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Sat, 30 Apr 2011 02:52:52 +0000 (22:52 -0400)
Let FTRACE_WARN_ON() be used as a stand alone statement or
inside a conditional: if (FTRACE_WARN_ON(x))

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c

index ee24fa1935ac7d25ec593ebfe3824f6339c0cea5..4ff65599c9731f15c20cd4bd9125196f62edfe78 100644 (file)
 #include "trace_stat.h"
 
 #define FTRACE_WARN_ON(cond)                   \
-       do {                                    \
-               if (WARN_ON(cond))              \
+       ({                                      \
+               int ___r = cond;                \
+               if (WARN_ON(___r))              \
                        ftrace_kill();          \
-       } while (0)
+               ___r;                           \
+       })
 
 #define FTRACE_WARN_ON_ONCE(cond)              \
-       do {                                    \
-               if (WARN_ON_ONCE(cond))         \
+       ({                                      \
+               int ___r = cond;                \
+               if (WARN_ON_ONCE(___r))         \
                        ftrace_kill();          \
-       } while (0)
+               ___r;                           \
+       })
 
 /* hash bits for specific function selection */
 #define FTRACE_HASH_BITS 7