summaryrefslogtreecommitdiff
path: root/include/linux/printk.h
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2022-04-21 23:28:46 +0206
committerPetr Mladek <pmladek@suse.com>2022-04-22 21:30:58 +0200
commit3b604ca81202eea2a917eb6491e90f610fba0ec7 (patch)
tree553f119d8bed892bed778c99e11faaaadf119cd6 /include/linux/printk.h
parent03a749e628fdbc665d7f9712637f880a79da8b78 (diff)
printk: add pr_flush()
Provide a might-sleep function to allow waiting for console printers to catch up to the latest logged message. Use pr_flush() whenever it is desirable to get buffered messages printed before continuing: suspend_console(), resume_console(), console_stop(), console_start(), console_unblank(). Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20220421212250.565456-12-john.ogness@linutronix.de
Diffstat (limited to 'include/linux/printk.h')
-rw-r--r--include/linux/printk.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/printk.h b/include/linux/printk.h
index b70a42f94031..091fba7283e1 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -170,6 +170,8 @@ extern void __printk_safe_exit(void);
#define printk_deferred_enter __printk_safe_enter
#define printk_deferred_exit __printk_safe_exit
+extern bool pr_flush(int timeout_ms, bool reset_on_progress);
+
/*
* Please don't use printk_ratelimit(), because it shares ratelimiting state
* with all other unrelated printk_ratelimit() callsites. Instead use
@@ -220,6 +222,11 @@ static inline void printk_deferred_exit(void)
{
}
+static inline bool pr_flush(int timeout_ms, bool reset_on_progress)
+{
+ return true;
+}
+
static inline int printk_ratelimit(void)
{
return 0;