diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-08-15 12:15:17 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-08-15 12:15:17 -0400 |
| commit | f3efbe582b5396d134024c03a5fa253f2a85d9a6 (patch) | |
| tree | e4e15b7567b82d24cb1e7327398286a2b88df04c /include/asm-generic/bug.h | |
| parent | 05d3ed0a1fe3ea05ab9f3b8d32576a0bc2e19660 (diff) | |
| parent | b635acec48bcaa9183fcbf4e3955616b0d4119b5 (diff) | |
Merge branch 'linus' into x86/gart
Diffstat (limited to 'include/asm-generic/bug.h')
| -rw-r--r-- | include/asm-generic/bug.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 2632328d8646..a3f738cffdb6 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h | |||
| @@ -34,9 +34,14 @@ struct bug_entry { | |||
| 34 | #ifndef __WARN | 34 | #ifndef __WARN |
| 35 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
| 36 | extern void warn_on_slowpath(const char *file, const int line); | 36 | extern void warn_on_slowpath(const char *file, const int line); |
| 37 | extern void warn_slowpath(const char *file, const int line, | ||
| 38 | const char *fmt, ...) __attribute__((format(printf, 3, 4))); | ||
| 37 | #define WANT_WARN_ON_SLOWPATH | 39 | #define WANT_WARN_ON_SLOWPATH |
| 38 | #endif | 40 | #endif |
| 39 | #define __WARN() warn_on_slowpath(__FILE__, __LINE__) | 41 | #define __WARN() warn_on_slowpath(__FILE__, __LINE__) |
| 42 | #define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) | ||
| 43 | #else | ||
| 44 | #define __WARN_printf(arg...) __WARN() | ||
| 40 | #endif | 45 | #endif |
| 41 | 46 | ||
| 42 | #ifndef WARN_ON | 47 | #ifndef WARN_ON |
| @@ -48,6 +53,15 @@ extern void warn_on_slowpath(const char *file, const int line); | |||
| 48 | }) | 53 | }) |
| 49 | #endif | 54 | #endif |
| 50 | 55 | ||
| 56 | #ifndef WARN | ||
| 57 | #define WARN(condition, format...) ({ \ | ||
| 58 | int __ret_warn_on = !!(condition); \ | ||
| 59 | if (unlikely(__ret_warn_on)) \ | ||
| 60 | __WARN_printf(format); \ | ||
| 61 | unlikely(__ret_warn_on); \ | ||
| 62 | }) | ||
| 63 | #endif | ||
| 64 | |||
| 51 | #else /* !CONFIG_BUG */ | 65 | #else /* !CONFIG_BUG */ |
| 52 | #ifndef HAVE_ARCH_BUG | 66 | #ifndef HAVE_ARCH_BUG |
| 53 | #define BUG() | 67 | #define BUG() |
| @@ -63,6 +77,14 @@ extern void warn_on_slowpath(const char *file, const int line); | |||
| 63 | unlikely(__ret_warn_on); \ | 77 | unlikely(__ret_warn_on); \ |
| 64 | }) | 78 | }) |
| 65 | #endif | 79 | #endif |
| 80 | |||
| 81 | #ifndef WARN | ||
| 82 | #define WARN(condition, format...) ({ \ | ||
| 83 | int __ret_warn_on = !!(condition); \ | ||
| 84 | unlikely(__ret_warn_on); \ | ||
| 85 | }) | ||
| 86 | #endif | ||
| 87 | |||
| 66 | #endif | 88 | #endif |
| 67 | 89 | ||
| 68 | #define WARN_ON_ONCE(condition) ({ \ | 90 | #define WARN_ON_ONCE(condition) ({ \ |
| @@ -75,6 +97,9 @@ extern void warn_on_slowpath(const char *file, const int line); | |||
| 75 | unlikely(__ret_warn_once); \ | 97 | unlikely(__ret_warn_once); \ |
| 76 | }) | 98 | }) |
| 77 | 99 | ||
| 100 | #define WARN_ON_RATELIMIT(condition, state) \ | ||
| 101 | WARN_ON((condition) && __ratelimit(state)) | ||
| 102 | |||
| 78 | #ifdef CONFIG_SMP | 103 | #ifdef CONFIG_SMP |
| 79 | # define WARN_ON_SMP(x) WARN_ON(x) | 104 | # define WARN_ON_SMP(x) WARN_ON(x) |
| 80 | #else | 105 | #else |
