aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2009-01-09 03:39:43 -0500
committerLen Brown <len.brown@intel.com>2009-01-09 03:39:43 -0500
commitb2576e1d4408e134e2188c967b1f28af39cd79d4 (patch)
tree004f3c82faab760f304ce031d6d2f572e7746a50 /include/linux/kernel.h
parent3cc8a5f4ba91f67bbdb81a43a99281a26aab8d77 (diff)
parent2150edc6c5cf00f7adb54538b9ea2a3e9cedca3f (diff)
Merge branch 'linus' into release
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h43
1 files changed, 27 insertions, 16 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index dc7e0d0a6474..343df9ef2412 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -48,6 +48,12 @@ extern const char linux_proc_banner[];
48#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 48#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
49#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 49#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
50#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 50#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
51#define DIV_ROUND_CLOSEST(x, divisor)( \
52{ \
53 typeof(divisor) __divisor = divisor; \
54 (((x) + ((__divisor) / 2)) / (__divisor)); \
55} \
56)
51 57
52#define _RET_IP_ (unsigned long)__builtin_return_address(0) 58#define _RET_IP_ (unsigned long)__builtin_return_address(0)
53#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) 59#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
@@ -141,6 +147,15 @@ extern int _cond_resched(void);
141 (__x < 0) ? -__x : __x; \ 147 (__x < 0) ? -__x : __x; \
142 }) 148 })
143 149
150#ifdef CONFIG_PROVE_LOCKING
151void might_fault(void);
152#else
153static inline void might_fault(void)
154{
155 might_sleep();
156}
157#endif
158
144extern struct atomic_notifier_head panic_notifier_list; 159extern struct atomic_notifier_head panic_notifier_list;
145extern long (*panic_blink)(long time); 160extern long (*panic_blink)(long time);
146NORET_TYPE void panic(const char * fmt, ...) 161NORET_TYPE void panic(const char * fmt, ...)
@@ -188,6 +203,8 @@ extern unsigned long long memparse(const char *ptr, char **retptr);
188extern int core_kernel_text(unsigned long addr); 203extern int core_kernel_text(unsigned long addr);
189extern int __kernel_text_address(unsigned long addr); 204extern int __kernel_text_address(unsigned long addr);
190extern int kernel_text_address(unsigned long addr); 205extern int kernel_text_address(unsigned long addr);
206extern int func_ptr_is_kernel_text(void *ptr);
207
191struct pid; 208struct pid;
192extern struct pid *session_of_pgrp(struct pid *pgrp); 209extern struct pid *session_of_pgrp(struct pid *pgrp);
193 210
@@ -338,13 +355,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
338 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
339 356
340/* If you are writing a driver, please use dev_dbg instead */ 357/* If you are writing a driver, please use dev_dbg instead */
341#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 358#if defined(DEBUG)
359#define pr_debug(fmt, ...) \
360 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
361#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
342#define pr_debug(fmt, ...) do { \ 362#define pr_debug(fmt, ...) do { \
343 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 363 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
344 } while (0) 364 } while (0)
345#elif defined(DEBUG)
346#define pr_debug(fmt, ...) \
347 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
348#else 365#else
349#define pr_debug(fmt, ...) \ 366#define pr_debug(fmt, ...) \
350 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) 367 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
@@ -361,18 +378,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
361 ((unsigned char *)&addr)[3] 378 ((unsigned char *)&addr)[3]
362#define NIPQUAD_FMT "%u.%u.%u.%u" 379#define NIPQUAD_FMT "%u.%u.%u.%u"
363 380
364#define NIP6(addr) \
365 ntohs((addr).s6_addr16[0]), \
366 ntohs((addr).s6_addr16[1]), \
367 ntohs((addr).s6_addr16[2]), \
368 ntohs((addr).s6_addr16[3]), \
369 ntohs((addr).s6_addr16[4]), \
370 ntohs((addr).s6_addr16[5]), \
371 ntohs((addr).s6_addr16[6]), \
372 ntohs((addr).s6_addr16[7])
373#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
374#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
375
376#if defined(__LITTLE_ENDIAN) 381#if defined(__LITTLE_ENDIAN)
377#define HIPQUAD(addr) \ 382#define HIPQUAD(addr) \
378 ((unsigned char *)&addr)[3], \ 383 ((unsigned char *)&addr)[3], \
@@ -471,6 +476,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
471 __val = __val < __min ? __min: __val; \ 476 __val = __val < __min ? __min: __val; \
472 __val > __max ? __max: __val; }) 477 __val > __max ? __max: __val; })
473 478
479
480/*
481 * swap - swap value of @a and @b
482 */
483#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
484
474/** 485/**
475 * container_of - cast a member of a structure out to the containing structure 486 * container_of - cast a member of a structure out to the containing structure
476 * @ptr: the pointer to the member. 487 * @ptr: the pointer to the member.