1 #ifndef __KERNEL_PRINTK__
2 #define __KERNEL_PRINTK__
3 
4 #include <stdio.h>
5 #include <linux/compiler.h>
6 
7 #define KERN_EMERG
8 #define KERN_ALERT
9 #define KERN_CRIT
10 #define KERN_ERR
11 #define KERN_WARNING
12 #define KERN_NOTICE
13 #define KERN_INFO
14 #define KERN_DEBUG
15 #define KERN_CONT
16 
17 #define printk(fmt, ...) \
18 	printf(fmt, ##__VA_ARGS__)
19 
20 /*
21  * Dummy printk for disabled debugging statements to use whilst maintaining
22  * gcc's format checking.
23  */
24 #define no_printk(fmt, ...)				\
25 ({							\
26 	if (0)						\
27 		printk(fmt, ##__VA_ARGS__);		\
28 	0;						\
29 })
30 
31 #define __printk(level, fmt, ...)					\
32 ({									\
33 	level < CONFIG_LOGLEVEL ? printk(fmt, ##__VA_ARGS__) : 0;	\
34 })
35 
36 #ifndef pr_fmt
37 #define pr_fmt(fmt) fmt
38 #endif
39 
40 #define pr_emerg(fmt, ...) \
41 	__printk(0, pr_fmt(fmt), ##__VA_ARGS__)
42 #define pr_alert(fmt, ...) \
43 	__printk(1, pr_fmt(fmt), ##__VA_ARGS__)
44 #define pr_crit(fmt, ...) \
45 	__printk(2, pr_fmt(fmt), ##__VA_ARGS__)
46 #define pr_err(fmt, ...) \
47 	__printk(3, pr_fmt(fmt), ##__VA_ARGS__)
48 #define pr_warning(fmt, ...) \
49 	__printk(4, pr_fmt(fmt), ##__VA_ARGS__)
50 #define pr_warn pr_warning
51 #define pr_notice(fmt, ...) \
52 	__printk(5, pr_fmt(fmt), ##__VA_ARGS__)
53 #define pr_info(fmt, ...) \
54 	__printk(6, pr_fmt(fmt), ##__VA_ARGS__)
55 
56 #define pr_cont(fmt, ...) \
57 	printk(fmt, ##__VA_ARGS__)
58 
59 /* pr_devel() should produce zero code unless DEBUG is defined */
60 #ifdef DEBUG
61 #define pr_devel(fmt, ...) \
62 	__printk(7, pr_fmt(fmt), ##__VA_ARGS__)
63 #else
64 #define pr_devel(fmt, ...) \
65 	no_printk(pr_fmt(fmt), ##__VA_ARGS__)
66 #endif
67 
68 #ifdef DEBUG
69 #define pr_debug(fmt, ...) \
70 	__printk(7, pr_fmt(fmt), ##__VA_ARGS__)
71 #else
72 #define pr_debug(fmt, ...) \
73 	no_printk(pr_fmt(fmt), ##__VA_ARGS__)
74 #endif
75 
76 #define printk_once(fmt, ...) \
77 	printk(fmt, ##__VA_ARGS__)
78 
79 #endif
80