If the CON_PRINTBUFFER flag is not set, do not replay the history
for that console.

Signed-off-by: John Ogness <john.ogn...@linutronix.de>
---
 kernel/printk/printk.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 6c875abd7b17..b97d4195b09a 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -399,10 +399,6 @@ static u32 log_first_idx;
 static u64 log_next_seq;
 static u32 log_next_idx;
 
-/* the next printk record to write to the console */
-static u64 console_seq;
-static u32 console_idx;
-
 /* the next printk record to read after the last 'clear' command */
 static u64 clear_seq;
 static u32 clear_idx;
@@ -1596,8 +1592,12 @@ static void call_console_drivers(u64 seq, const char 
*ext_text, size_t ext_len,
                if (!(con->flags & CON_ENABLED))
                        continue;
                if (!con->wrote_history) {
-                       printk_write_history(con, seq);
-                       continue;
+                       if (con->flags & CON_PRINTBUFFER) {
+                               printk_write_history(con, seq);
+                               continue;
+                       }
+                       con->wrote_history = 1;
+                       con->printk_seq = seq - 1;
                }
                if (!con->write)
                        continue;
@@ -1822,8 +1822,6 @@ EXPORT_SYMBOL(printk);
 
 static u64 syslog_seq;
 static u32 syslog_idx;
-static u64 console_seq;
-static u32 console_idx;
 static u64 log_first_seq;
 static u32 log_first_idx;
 static u64 log_next_seq;
@@ -2224,7 +2222,6 @@ early_param("keep_bootcon", keep_bootcon_setup);
 void register_console(struct console *newcon)
 {
        int i;
-       unsigned long flags;
        struct console *bcon = NULL;
        struct console_cmdline *c;
        static bool has_preferred;
@@ -2340,16 +2337,6 @@ void register_console(struct console *newcon)
        if (newcon->flags & CON_EXTENDED)
                nr_ext_console_drivers++;
 
-       if (newcon->flags & CON_PRINTBUFFER) {
-               /*
-                * console_unlock(); will print out the buffered messages
-                * for us.
-                */
-               logbuf_lock_irqsave(flags);
-               console_seq = syslog_seq;
-               console_idx = syslog_idx;
-               logbuf_unlock_irqrestore(flags);
-       }
        console_unlock();
        console_sysfs_notify();
 
-- 
2.11.0

Reply via email to