diff options
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 328bca609b9b..7f0707463360 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)) |
@@ -124,7 +134,7 @@ extern int _cond_resched(void); | |||
124 | #endif | 134 | #endif |
125 | 135 | ||
126 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 136 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
127 | void __might_sleep(char *file, int line, int preempt_offset); | 137 | void __might_sleep(const char *file, int line, int preempt_offset); |
128 | /** | 138 | /** |
129 | * might_sleep - annotation for functions that can sleep | 139 | * might_sleep - annotation for functions that can sleep |
130 | * | 140 | * |
@@ -138,7 +148,8 @@ extern int _cond_resched(void); | |||
138 | # define might_sleep() \ | 148 | # define might_sleep() \ |
139 | do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) | 149 | do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) |
140 | #else | 150 | #else |
141 | static inline void __might_sleep(char *file, int line, int preempt_offset) { } | 151 | static inline void __might_sleep(const char *file, int line, |
152 | int preempt_offset) { } | ||
142 | # define might_sleep() do { might_resched(); } while (0) | 153 | # define might_sleep() do { might_resched(); } while (0) |
143 | #endif | 154 | #endif |
144 | 155 | ||