diff options
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 1221d2331a6d..9365227dbaf6 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -44,6 +44,16 @@ extern const char linux_proc_banner[]; | |||
| 44 | 44 | ||
| 45 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | 45 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) |
| 46 | 46 | ||
| 47 | /* | ||
| 48 | * This looks more complex than it should be. But we need to | ||
| 49 | * get the type for the ~ right in round_down (it needs to be | ||
| 50 | * as wide as the result!), and we want to evaluate the macro | ||
| 51 | * arguments just once each. | ||
| 52 | */ | ||
| 53 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | ||
| 54 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | ||
| 55 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | ||
| 56 | |||
| 47 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | 57 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) |
| 48 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | 58 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
| 49 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | 59 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
| @@ -416,7 +426,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 416 | .burst = DEFAULT_RATELIMIT_BURST, \ | 426 | .burst = DEFAULT_RATELIMIT_BURST, \ |
| 417 | }; \ | 427 | }; \ |
| 418 | \ | 428 | \ |
| 419 | if (!__ratelimit(&_rs)) \ | 429 | if (__ratelimit(&_rs)) \ |
| 420 | printk(fmt, ##__VA_ARGS__); \ | 430 | printk(fmt, ##__VA_ARGS__); \ |
| 421 | }) | 431 | }) |
| 422 | #else | 432 | #else |
