aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h25
1 files changed, 7 insertions, 18 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 80f39cab470a..b0c4a05a4b0c 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -13,11 +13,10 @@
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/compiler.h> 14#include <linux/compiler.h>
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/log2.h>
16#include <asm/byteorder.h> 17#include <asm/byteorder.h>
17#include <asm/bug.h> 18#include <asm/bug.h>
18 19
19extern const char linux_banner[];
20
21#define INT_MAX ((int)(~0U>>1)) 20#define INT_MAX ((int)(~0U>>1))
22#define INT_MIN (-INT_MAX - 1) 21#define INT_MIN (-INT_MAX - 1)
23#define UINT_MAX (~0U) 22#define UINT_MAX (~0U)
@@ -30,8 +29,10 @@ extern const char linux_banner[];
30 29
31#define STACK_MAGIC 0xdeadbeef 30#define STACK_MAGIC 0xdeadbeef
32 31
32#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
33#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
34
33#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 35#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
34#define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
35#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 36#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
36#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 37#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
37#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 38#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
@@ -63,7 +64,7 @@ struct user;
63 * context (spinlock, irq-handler, ...). 64 * context (spinlock, irq-handler, ...).
64 * 65 *
65 * This is a useful debugging help to be able to catch problems early and not 66 * This is a useful debugging help to be able to catch problems early and not
66 * be biten later when the calling function happens to sleep when it is not 67 * be bitten later when the calling function happens to sleep when it is not
67 * supposed to. 68 * supposed to.
68 */ 69 */
69#ifdef CONFIG_PREEMPT_VOLUNTARY 70#ifdef CONFIG_PREEMPT_VOLUNTARY
@@ -155,22 +156,10 @@ static inline int printk(const char *s, ...) { return 0; }
155 156
156unsigned long int_sqrt(unsigned long); 157unsigned long int_sqrt(unsigned long);
157 158
158static inline int __attribute_pure__ long_log2(unsigned long x)
159{
160 int r = 0;
161 for (x >>= 1; x > 0; x >>= 1)
162 r++;
163 return r;
164}
165
166static inline unsigned long
167__attribute_const__ roundup_pow_of_two(unsigned long x)
168{
169 return 1UL << fls_long(x - 1);
170}
171
172extern int printk_ratelimit(void); 159extern int printk_ratelimit(void);
173extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); 160extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
161extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
162 unsigned int interval_msec);
174 163
175static inline void console_silent(void) 164static inline void console_silent(void)
176{ 165{