diff options
Diffstat (limited to 'include/linux/dynamic_debug.h')
| -rw-r--r-- | include/linux/dynamic_debug.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 0564e3c39882..7e3c53a900d8 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
| @@ -15,20 +15,24 @@ struct _ddebug { | |||
| 15 | const char *function; | 15 | const char *function; |
| 16 | const char *filename; | 16 | const char *filename; |
| 17 | const char *format; | 17 | const char *format; |
| 18 | unsigned int lineno:24; | 18 | unsigned int lineno:18; |
| 19 | /* | 19 | /* |
| 20 | * The flags field controls the behaviour at the callsite. | 20 | * The flags field controls the behaviour at the callsite. |
| 21 | * The bits here are changed dynamically when the user | 21 | * The bits here are changed dynamically when the user |
| 22 | * writes commands to <debugfs>/dynamic_debug/control | 22 | * writes commands to <debugfs>/dynamic_debug/control |
| 23 | */ | 23 | */ |
| 24 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ | 24 | #define _DPRINTK_FLAGS_NONE 0 |
| 25 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ | ||
| 25 | #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) | 26 | #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) |
| 26 | #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) | 27 | #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) |
| 27 | #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) | 28 | #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) |
| 28 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) | 29 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) |
| 30 | #if defined DEBUG | ||
| 31 | #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT | ||
| 32 | #else | ||
| 29 | #define _DPRINTK_FLAGS_DEFAULT 0 | 33 | #define _DPRINTK_FLAGS_DEFAULT 0 |
| 34 | #endif | ||
| 30 | unsigned int flags:8; | 35 | unsigned int flags:8; |
| 31 | char enabled; | ||
| 32 | } __attribute__((aligned(8))); | 36 | } __attribute__((aligned(8))); |
| 33 | 37 | ||
| 34 | 38 | ||
| @@ -62,21 +66,20 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor, | |||
| 62 | .format = (fmt), \ | 66 | .format = (fmt), \ |
| 63 | .lineno = __LINE__, \ | 67 | .lineno = __LINE__, \ |
| 64 | .flags = _DPRINTK_FLAGS_DEFAULT, \ | 68 | .flags = _DPRINTK_FLAGS_DEFAULT, \ |
| 65 | .enabled = false, \ | ||
| 66 | } | 69 | } |
| 67 | 70 | ||
| 68 | #define dynamic_pr_debug(fmt, ...) \ | 71 | #define dynamic_pr_debug(fmt, ...) \ |
| 69 | do { \ | 72 | do { \ |
| 70 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 73 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
| 71 | if (unlikely(descriptor.enabled)) \ | 74 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
| 72 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ | 75 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ |
| 73 | ##__VA_ARGS__); \ | 76 | ##__VA_ARGS__); \ |
| 74 | } while (0) | 77 | } while (0) |
| 75 | 78 | ||
| 76 | #define dynamic_dev_dbg(dev, fmt, ...) \ | 79 | #define dynamic_dev_dbg(dev, fmt, ...) \ |
| 77 | do { \ | 80 | do { \ |
| 78 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 81 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
| 79 | if (unlikely(descriptor.enabled)) \ | 82 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
| 80 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ | 83 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ |
| 81 | ##__VA_ARGS__); \ | 84 | ##__VA_ARGS__); \ |
| 82 | } while (0) | 85 | } while (0) |
| @@ -84,7 +87,7 @@ do { \ | |||
| 84 | #define dynamic_netdev_dbg(dev, fmt, ...) \ | 87 | #define dynamic_netdev_dbg(dev, fmt, ...) \ |
| 85 | do { \ | 88 | do { \ |
| 86 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 89 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
| 87 | if (unlikely(descriptor.enabled)) \ | 90 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
| 88 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ | 91 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ |
| 89 | ##__VA_ARGS__); \ | 92 | ##__VA_ARGS__); \ |
| 90 | } while (0) | 93 | } while (0) |
