diff options
| author | Robert Richter <robert.richter@amd.com> | 2010-06-04 05:33:10 -0400 |
|---|---|---|
| committer | Robert Richter <robert.richter@amd.com> | 2010-06-04 05:33:10 -0400 |
| commit | d8a382d2662822248a97ce9d670b90e68aefbd3a (patch) | |
| tree | 4f5bbd5d0a5881ed42de611402ea4ac2c6d6ff48 /include/linux/kernel.h | |
| parent | 45c34e05c4e3d36e7c44e790241ea11a1d90d54e (diff) | |
| parent | c6df8d5ab87a246942d138321e1721edbb69f6e1 (diff) | |
Merge remote branch 'tip/perf/urgent' into oprofile/urgent
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 9365227dbaf6..8317ec4b9f3b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | /* | 4 | /* |
| 5 | * 'kernel.h' contains some often-used function prototypes etc | 5 | * 'kernel.h' contains some often-used function prototypes etc |
| 6 | */ | 6 | */ |
| 7 | #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) | ||
| 8 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) | ||
| 7 | 9 | ||
| 8 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
| 9 | 11 | ||
| @@ -22,9 +24,9 @@ | |||
| 22 | extern const char linux_banner[]; | 24 | extern const char linux_banner[]; |
| 23 | extern const char linux_proc_banner[]; | 25 | extern const char linux_proc_banner[]; |
| 24 | 26 | ||
| 25 | #define USHORT_MAX ((u16)(~0U)) | 27 | #define USHRT_MAX ((u16)(~0U)) |
| 26 | #define SHORT_MAX ((s16)(USHORT_MAX>>1)) | 28 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) |
| 27 | #define SHORT_MIN (-SHORT_MAX - 1) | 29 | #define SHRT_MIN ((s16)(-SHRT_MAX - 1)) |
| 28 | #define INT_MAX ((int)(~0U>>1)) | 30 | #define INT_MAX ((int)(~0U>>1)) |
| 29 | #define INT_MIN (-INT_MAX - 1) | 31 | #define INT_MIN (-INT_MAX - 1) |
| 30 | #define UINT_MAX (~0U) | 32 | #define UINT_MAX (~0U) |
| @@ -37,8 +39,8 @@ extern const char linux_proc_banner[]; | |||
| 37 | 39 | ||
| 38 | #define STACK_MAGIC 0xdeadbeef | 40 | #define STACK_MAGIC 0xdeadbeef |
| 39 | 41 | ||
| 40 | #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) | 42 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) |
| 41 | #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) | 43 | #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) |
| 42 | #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) | 44 | #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) |
| 43 | #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) | 45 | #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) |
| 44 | 46 | ||
| @@ -344,6 +346,7 @@ extern enum system_states { | |||
| 344 | #define TAINT_OVERRIDDEN_ACPI_TABLE 8 | 346 | #define TAINT_OVERRIDDEN_ACPI_TABLE 8 |
| 345 | #define TAINT_WARN 9 | 347 | #define TAINT_WARN 9 |
| 346 | #define TAINT_CRAP 10 | 348 | #define TAINT_CRAP 10 |
| 349 | #define TAINT_FIRMWARE_WORKAROUND 11 | ||
| 347 | 350 | ||
| 348 | extern void dump_stack(void) __cold; | 351 | extern void dump_stack(void) __cold; |
| 349 | 352 | ||
| @@ -372,6 +375,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 372 | return buf; | 375 | return buf; |
| 373 | } | 376 | } |
| 374 | 377 | ||
| 378 | extern int hex_to_bin(char ch); | ||
| 379 | |||
| 375 | #ifndef pr_fmt | 380 | #ifndef pr_fmt |
| 376 | #define pr_fmt(fmt) fmt | 381 | #define pr_fmt(fmt) fmt |
| 377 | #endif | 382 | #endif |
| @@ -386,6 +391,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 386 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | 391 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
| 387 | #define pr_warning(fmt, ...) \ | 392 | #define pr_warning(fmt, ...) \ |
| 388 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | 393 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
| 394 | #define pr_warn pr_warning | ||
| 389 | #define pr_notice(fmt, ...) \ | 395 | #define pr_notice(fmt, ...) \ |
| 390 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) | 396 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
| 391 | #define pr_info(fmt, ...) \ | 397 | #define pr_info(fmt, ...) \ |
| @@ -420,14 +426,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 420 | * no local ratelimit_state used in the !PRINTK case | 426 | * no local ratelimit_state used in the !PRINTK case |
| 421 | */ | 427 | */ |
| 422 | #ifdef CONFIG_PRINTK | 428 | #ifdef CONFIG_PRINTK |
| 423 | #define printk_ratelimited(fmt, ...) ({ \ | 429 | #define printk_ratelimited(fmt, ...) ({ \ |
| 424 | static struct ratelimit_state _rs = { \ | 430 | static DEFINE_RATELIMIT_STATE(_rs, \ |
| 425 | .interval = DEFAULT_RATELIMIT_INTERVAL, \ | 431 | DEFAULT_RATELIMIT_INTERVAL, \ |
| 426 | .burst = DEFAULT_RATELIMIT_BURST, \ | 432 | DEFAULT_RATELIMIT_BURST); \ |
| 427 | }; \ | 433 | \ |
| 428 | \ | 434 | if (__ratelimit(&_rs)) \ |
| 429 | if (__ratelimit(&_rs)) \ | 435 | printk(fmt, ##__VA_ARGS__); \ |
| 430 | printk(fmt, ##__VA_ARGS__); \ | ||
| 431 | }) | 436 | }) |
| 432 | #else | 437 | #else |
| 433 | /* No effect, but we still get type checking even in the !PRINTK case: */ | 438 | /* No effect, but we still get type checking even in the !PRINTK case: */ |
| @@ -444,6 +449,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 444 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | 449 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
| 445 | #define pr_warning_ratelimited(fmt, ...) \ | 450 | #define pr_warning_ratelimited(fmt, ...) \ |
| 446 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | 451 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
| 452 | #define pr_warn_ratelimited pr_warning_ratelimited | ||
| 447 | #define pr_notice_ratelimited(fmt, ...) \ | 453 | #define pr_notice_ratelimited(fmt, ...) \ |
| 448 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) | 454 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
| 449 | #define pr_info_ratelimited(fmt, ...) \ | 455 | #define pr_info_ratelimited(fmt, ...) \ |
| @@ -490,6 +496,13 @@ static inline void tracing_off(void) { } | |||
| 490 | static inline void tracing_off_permanent(void) { } | 496 | static inline void tracing_off_permanent(void) { } |
| 491 | static inline int tracing_is_on(void) { return 0; } | 497 | static inline int tracing_is_on(void) { return 0; } |
| 492 | #endif | 498 | #endif |
| 499 | |||
| 500 | enum ftrace_dump_mode { | ||
| 501 | DUMP_NONE, | ||
| 502 | DUMP_ALL, | ||
| 503 | DUMP_ORIG, | ||
| 504 | }; | ||
| 505 | |||
| 493 | #ifdef CONFIG_TRACING | 506 | #ifdef CONFIG_TRACING |
| 494 | extern void tracing_start(void); | 507 | extern void tracing_start(void); |
| 495 | extern void tracing_stop(void); | 508 | extern void tracing_stop(void); |
| @@ -571,7 +584,7 @@ __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); | |||
| 571 | extern int | 584 | extern int |
| 572 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); | 585 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); |
| 573 | 586 | ||
| 574 | extern void ftrace_dump(void); | 587 | extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); |
| 575 | #else | 588 | #else |
| 576 | static inline void | 589 | static inline void |
| 577 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | 590 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } |
| @@ -592,7 +605,7 @@ ftrace_vprintk(const char *fmt, va_list ap) | |||
| 592 | { | 605 | { |
| 593 | return 0; | 606 | return 0; |
| 594 | } | 607 | } |
| 595 | static inline void ftrace_dump(void) { } | 608 | static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } |
| 596 | #endif /* CONFIG_TRACING */ | 609 | #endif /* CONFIG_TRACING */ |
| 597 | 610 | ||
| 598 | /* | 611 | /* |
