diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-07-15 09:42:32 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-07-15 09:42:32 -0700 |
| commit | ecb41832bd2a7a3f8ac93527cec5e51e3827daed (patch) | |
| tree | a382a3719eca9ac8a22ae7f1715d0bd4843dc8e2 /include/linux/compiler.h | |
| parent | d38b6cf50a6b911ee46683330f3af17fcceca509 (diff) | |
| parent | 0ecfebd2b52404ae0c54a878c872bb93363ada36 (diff) | |
| download | lwn-ecb41832bd2a7a3f8ac93527cec5e51e3827daed.tar.gz lwn-ecb41832bd2a7a3f8ac93527cec5e51e3827daed.zip | |
Merge tag 'v5.2' into next
Sync up with mainline to resolve conflicts in iforce driver.
Diffstat (limited to 'include/linux/compiler.h')
| -rw-r--r-- | include/linux/compiler.h | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 445348facea9..8aaf7cd026b0 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -53,23 +53,24 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, * "Define 'is'", Bill Clinton * "Define 'if'", Steven Rostedt */ -#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) -#define __trace_if(cond) \ - if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ - ({ \ - int ______r; \ - static struct ftrace_branch_data \ - __aligned(4) \ - __section("_ftrace_branch") \ - ______f = { \ - .func = __func__, \ - .file = __FILE__, \ - .line = __LINE__, \ - }; \ - ______r = !!(cond); \ - ______f.miss_hit[______r]++; \ - ______r; \ - })) +#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) + +#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) + +#define __trace_if_value(cond) ({ \ + static struct ftrace_branch_data \ + __aligned(4) \ + __section("_ftrace_branch") \ + __if_trace = { \ + .func = __func__, \ + .file = __FILE__, \ + .line = __LINE__, \ + }; \ + (cond) ? \ + (__if_trace.miss_hit[1]++,1) : \ + (__if_trace.miss_hit[0]++,0); \ +}) + #endif /* CONFIG_PROFILE_ALL_BRANCHES */ #else |
