Rev 3031 | Rev 3480 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3031 | Rev 3391 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef _ASM_GENERIC_BUG_H |
1 | #ifndef _ASM_GENERIC_BUG_H |
2 | #define _ASM_GENERIC_BUG_H |
2 | #define _ASM_GENERIC_BUG_H |
Line -... | Line 3... | ||
- | 3 | ||
- | 4 | //extern __printf(3, 4) |
|
- | 5 | //void warn_slowpath_fmt(const char *file, const int line, |
|
- | 6 | // const char *fmt, ...); |
|
- | 7 | //extern __printf(4, 5) |
|
- | 8 | //void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint, |
|
- | 9 | // const char *fmt, ...); |
|
- | 10 | ||
- | 11 | //extern void warn_slowpath_null(const char *file, const int line); |
|
- | 12 | ||
- | 13 | #define __WARN() printf("\nWARNING: at %s:%d\n", __FILE__, __LINE__) |
|
Line 3... | Line 14... | ||
3 | 14 | #define __WARN_printf(arg...) printf("\nWARNING: at %s:%d\n", __FILE__, __LINE__) |
|
4 | 15 | ||
- | 16 | ||
- | 17 | #define WARN(condition, format...) ({ \ |
|
- | 18 | int __ret_warn_on = !!(condition); \ |
|
- | 19 | if (unlikely(__ret_warn_on)) \ |
|
- | 20 | __WARN_printf(format); \ |
|
- | 21 | unlikely(__ret_warn_on); \ |
|
- | 22 | }) |
|
- | 23 | ||
- | 24 | ||
- | 25 | #define WARN_ON(condition) ({ \ |
|
5 | 26 | int __ret_warn_on = !!(condition); \ |
|
6 | #define WARN(condition, format...) ({ \ |
27 | if (unlikely(__ret_warn_on)) \ |
Line -... | Line 28... | ||
- | 28 | __WARN(); \ |
|
- | 29 | unlikely(__ret_warn_on); \ |
|
- | 30 | }) |
|
- | 31 | ||
- | 32 | ||
- | 33 | #define WARN_ONCE(condition, format...) ({ \ |
|
- | 34 | static bool __warned; \ |
|
- | 35 | int __ret_warn_once = !!(condition); \ |
|
- | 36 | \ |
|
- | 37 | if (unlikely(__ret_warn_once)) \ |
|
- | 38 | if (WARN(!__warned, format)) \ |
|
- | 39 | __warned = true; \ |
|
- | 40 | unlikely(__ret_warn_once); \ |
|
- | 41 | }) |
|
- | 42 | ||
- | 43 | ||
- | 44 | #define WARN_ON_ONCE(condition) ({ \ |
|
- | 45 | static bool __warned; \ |
|
- | 46 | int __ret_warn_once = !!(condition); \ |
|
- | 47 | \ |
|
- | 48 | if (unlikely(__ret_warn_once)) \ |
|
- | 49 | if (WARN_ON(!__warned)) \ |
|
- | 50 | __warned = true; \ |
|
- | 51 | unlikely(__ret_warn_once); \ |
|
- | 52 | }) |
|
- | 53 | ||
- | 54 | #define BUG() do { \ |
|
- | 55 | printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \ |
|
- | 56 | while(1){ delay(10); }; \ |
|
- | 57 | } while (0) |
|
7 | int __ret_warn_on = !!(condition); \ |
58 |