diff options
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 2b5b1e0899a8..d3cd23f30039 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -146,7 +146,7 @@ extern int _cond_resched(void); | |||
| 146 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) | 146 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) |
| 147 | 147 | ||
| 148 | #define abs(x) ({ \ | 148 | #define abs(x) ({ \ |
| 149 | int __x = (x); \ | 149 | long __x = (x); \ |
| 150 | (__x < 0) ? -__x : __x; \ | 150 | (__x < 0) ? -__x : __x; \ |
| 151 | }) | 151 | }) |
| 152 | 152 | ||
| @@ -246,14 +246,16 @@ extern int printk_ratelimit(void); | |||
| 246 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 246 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
| 247 | unsigned int interval_msec); | 247 | unsigned int interval_msec); |
| 248 | 248 | ||
| 249 | extern int printk_delay_msec; | ||
| 250 | |||
| 249 | /* | 251 | /* |
| 250 | * Print a one-time message (analogous to WARN_ONCE() et al): | 252 | * Print a one-time message (analogous to WARN_ONCE() et al): |
| 251 | */ | 253 | */ |
| 252 | #define printk_once(x...) ({ \ | 254 | #define printk_once(x...) ({ \ |
| 253 | static int __print_once = 1; \ | 255 | static bool __print_once = true; \ |
| 254 | \ | 256 | \ |
| 255 | if (__print_once) { \ | 257 | if (__print_once) { \ |
| 256 | __print_once = 0; \ | 258 | __print_once = false; \ |
| 257 | printk(x); \ | 259 | printk(x); \ |
| 258 | } \ | 260 | } \ |
| 259 | }) | 261 | }) |
| @@ -676,13 +678,17 @@ struct sysinfo { | |||
| 676 | }; | 678 | }; |
| 677 | 679 | ||
| 678 | /* Force a compilation error if condition is true */ | 680 | /* Force a compilation error if condition is true */ |
| 679 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | 681 | #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) |
| 682 | |||
| 683 | /* Force a compilation error if condition is constant and true */ | ||
| 684 | #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) | ||
| 680 | 685 | ||
| 681 | /* Force a compilation error if condition is true, but also produce a | 686 | /* Force a compilation error if condition is true, but also produce a |
| 682 | result (of value 0 and type size_t), so the expression can be used | 687 | result (of value 0 and type size_t), so the expression can be used |
| 683 | e.g. in a structure initializer (or where-ever else comma expressions | 688 | e.g. in a structure initializer (or where-ever else comma expressions |
| 684 | aren't permitted). */ | 689 | aren't permitted). */ |
| 685 | #define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) | 690 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) |
| 691 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | ||
| 686 | 692 | ||
| 687 | /* Trap pasters of __FUNCTION__ at compile-time */ | 693 | /* Trap pasters of __FUNCTION__ at compile-time */ |
| 688 | #define __FUNCTION__ (__func__) | 694 | #define __FUNCTION__ (__func__) |
