]>
Commit | Line | Data |
---|---|---|
1ccea77e | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
42a0bb3f PM |
2 | /* |
3 | * internal.h - printk internal definitions | |
42a0bb3f PM |
4 | */ |
5 | #include <linux/percpu.h> | |
6 | ||
099f1c84 SS |
7 | #ifdef CONFIG_PRINTK |
8 | ||
a1ad4b8a CD |
9 | /* Flags for a single printk record. */ |
10 | enum printk_info_flags { | |
11 | LOG_NEWLINE = 2, /* text ended with a newline */ | |
12 | LOG_CONT = 8, /* text is a fragment of a continuation line */ | |
13 | }; | |
14 | ||
74caba7f | 15 | __printf(4, 0) |
03fc7f9c | 16 | int vprintk_store(int facility, int level, |
74caba7f | 17 | const struct dev_printk_info *dev_info, |
03fc7f9c PM |
18 | const char *fmt, va_list args); |
19 | ||
099f1c84 | 20 | __printf(1, 0) int vprintk_default(const char *fmt, va_list args); |
719f6a70 | 21 | __printf(1, 0) int vprintk_deferred(const char *fmt, va_list args); |
099f1c84 | 22 | |
ab6f762f SS |
23 | bool printk_percpu_data_ready(void); |
24 | ||
099f1c84 SS |
25 | #define printk_safe_enter_irqsave(flags) \ |
26 | do { \ | |
27 | local_irq_save(flags); \ | |
28 | __printk_safe_enter(); \ | |
29 | } while (0) | |
30 | ||
31 | #define printk_safe_exit_irqrestore(flags) \ | |
32 | do { \ | |
33 | __printk_safe_exit(); \ | |
34 | local_irq_restore(flags); \ | |
35 | } while (0) | |
36 | ||
03fc7f9c PM |
37 | void defer_console_output(void); |
38 | ||
f3d75cf5 CD |
39 | u16 printk_parse_prefix(const char *text, int *level, |
40 | enum printk_info_flags *flags); | |
099f1c84 SS |
41 | #else |
42 | ||
099f1c84 | 43 | /* |
996e9666 | 44 | * In !PRINTK builds we still export console_sem |
099f1c84 SS |
45 | * semaphore and some of console functions (console_unlock()/etc.), so |
46 | * printk-safe must preserve the existing local IRQ guarantees. | |
47 | */ | |
48 | #define printk_safe_enter_irqsave(flags) local_irq_save(flags) | |
49 | #define printk_safe_exit_irqrestore(flags) local_irq_restore(flags) | |
50 | ||
ab6f762f | 51 | static inline bool printk_percpu_data_ready(void) { return false; } |
099f1c84 | 52 | #endif /* CONFIG_PRINTK */ |