[Skiboot] [RFC PATCH 08/10] console: excise flush_to_drivers

Oliver O'Halloran oohall at gmail.com
Wed Dec 21 16:35:42 AEDT 2016


This is no longer used and can be removed.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/console-log.c                      |  6 +-----
 core/console.c                          | 10 +++++-----
 core/test/run-console-flush.c           |  2 +-
 core/test/run-console-log-buf-overrun.c |  5 +----
 core/test/run-console-log-pr_fmt.c      | 16 ++++------------
 core/test/run-console-log.c             | 13 +------------
 include/console.h                       |  2 +-
 7 files changed, 14 insertions(+), 40 deletions(-)

diff --git a/core/console-log.c b/core/console-log.c
index 4c1365bff04c..7173199135fd 100644
--- a/core/console-log.c
+++ b/core/console-log.c
@@ -32,7 +32,6 @@ static int vprlog(int log_level, const char *fmt, va_list ap)
 {
 	int count;
 	char buffer[320];
-	bool flush_to_drivers = true;
 	unsigned long tb = mftb();
 
 	/* It's safe to return 0 when we "did" something here
@@ -50,10 +49,7 @@ static int vprlog(int log_level, const char *fmt, va_list ap)
 			 tb_to_secs(tb), tb_remaining_nsecs(tb), log_level);
 	count+= vsnprintf(buffer+count, sizeof(buffer)-count, fmt, ap);
 
-	if (log_level > (debug_descriptor.console_log_levels & 0x0f))
-		flush_to_drivers = false;
-
-	console_write(flush_to_drivers, buffer, count);
+	console_write(buffer, count);
 
 	return count;
 }
diff --git a/core/console.c b/core/console.c
index 7ba22d33c7eb..4a46f6ebaaa5 100644
--- a/core/console.c
+++ b/core/console.c
@@ -159,7 +159,7 @@ static int find_eol(int start)
  * if there is more to go, but that only happens when the
  * underlying driver failed so don't call it again.
  */
-static bool __flush_console(bool flush_to_drivers __unused)
+static bool __flush_console(void)
 {
 	int flush_lvl = debug_descriptor.console_log_levels & 0xf;
 	struct cpu_thread *cpu = this_cpu();
@@ -242,7 +242,7 @@ bool flush_console(void)
 	bool ret;
 
 	lock(&con_lock);
-	ret = __flush_console(true);
+	ret = __flush_console();
 	unlock(&con_lock);
 
 	return ret;
@@ -301,7 +301,7 @@ static void write_char(char c)
 	inmem_write(c);
 }
 
-ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count)
+ssize_t console_write(const void *buf, size_t count)
 {
 	/* We use recursive locking here as we can get called
 	 * from fairly deep debug path
@@ -316,7 +316,7 @@ ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count)
 		write_char(c);
 	}
 
-	__flush_console(flush_to_drivers);
+	__flush_console();
 
 	if (need_unlock)
 		unlock(&con_lock);
@@ -326,7 +326,7 @@ ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count)
 
 ssize_t write(int fd __unused, const void *buf, size_t count)
 {
-	return console_write(true, buf, count);
+	return console_write(buf, count);
 }
 
 ssize_t read(int fd __unused, void *buf, size_t req_count)
diff --git a/core/test/run-console-flush.c b/core/test/run-console-flush.c
index 51451fde4030..d19e8a163d14 100644
--- a/core/test/run-console-flush.c
+++ b/core/test/run-console-flush.c
@@ -116,7 +116,7 @@ int main(void)
 	memcons.obuf_size = sizeof(console_buffer);
 
 	populate_console(PR_INSANE, PR_NOTICE);
-	__flush_console(true);
+	__flush_console();
 
 	/*
 	 * Refill the console buffer dropping everything above PR_NOTICE
diff --git a/core/test/run-console-log-buf-overrun.c b/core/test/run-console-log-buf-overrun.c
index 01fca9b8f6fb..a2b253e62ce5 100644
--- a/core/test/run-console-log-buf-overrun.c
+++ b/core/test/run-console-log-buf-overrun.c
@@ -53,11 +53,8 @@ static inline unsigned long mftb(void)
 char console_buffer[4096];
 struct debug_descriptor debug_descriptor;
 
-bool flushed_to_drivers;
-
-ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count)
+ssize_t console_write(const void *buf, size_t count)
 {
-	flushed_to_drivers = flush_to_drivers;
 	memcpy(console_buffer, buf, count);
 	return count;
 }
diff --git a/core/test/run-console-log-pr_fmt.c b/core/test/run-console-log-pr_fmt.c
index ae9d206cb626..b8204b90ce2b 100644
--- a/core/test/run-console-log-pr_fmt.c
+++ b/core/test/run-console-log-pr_fmt.c
@@ -36,13 +36,10 @@ static inline unsigned long mftb(void)
 #include "../../libc/stdio/vsnprintf.c"
 
 struct debug_descriptor debug_descriptor;
-
-bool flushed_to_drivers;
 char console_buffer[4096];
 
-ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count)
+ssize_t console_write(const void *buf, size_t count)
 {
-	flushed_to_drivers = flush_to_drivers;
 	memcpy(console_buffer, buf, count);
 	return count;
 }
@@ -51,24 +48,19 @@ int main(void)
 {
 	debug_descriptor.console_log_levels = 0x75;
 
+	/* check basic functionality */
 	prlog(PR_EMERG, "Hello World");
 	assert(strcmp(console_buffer, "[    0.000000042,0] PREFIX: Hello World") == 0);
-	assert(flushed_to_drivers==true);
 
 	memset(console_buffer, 0, sizeof(console_buffer));
 
-	// Below log level
+	/* Below log level is filtered */
 	prlog(PR_TRACE, "Hello World");
 	assert(console_buffer[0] == 0);
 
-	// Should not be flushed to console
-	prlog(PR_DEBUG, "Hello World");
-	assert(strcmp(console_buffer, "[    0.000000042,7] PREFIX: Hello World") == 0);
-	assert(flushed_to_drivers==false);
-
+	/* check printf */
 	printf("Hello World");
 	assert(strcmp(console_buffer, "[    0.000000042,5] PREFIX: Hello World") == 0);
-	assert(flushed_to_drivers==true);
 
 	return 0;
 }
diff --git a/core/test/run-console-log.c b/core/test/run-console-log.c
index 01376eee7334..1e2dd5039986 100644
--- a/core/test/run-console-log.c
+++ b/core/test/run-console-log.c
@@ -36,13 +36,10 @@ int _printf(const char* fmt, ...);
 #include "../console-log.c"
 
 struct debug_descriptor debug_descriptor;
-
-bool flushed_to_drivers;
 char console_buffer[4096];
 
-ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count)
+ssize_t console_write(const void *buf, size_t count)
 {
-	flushed_to_drivers = flush_to_drivers;
 	memcpy(console_buffer, buf, count);
 	return count;
 }
@@ -53,22 +50,14 @@ int main(void)
 
 	prlog(PR_EMERG, "Hello World");
 	assert(strcmp(console_buffer, "[    0.000000042,0] Hello World") == 0);
-	assert(flushed_to_drivers==true);
-
 	memset(console_buffer, 0, sizeof(console_buffer));
 
 	// Below log level
 	prlog(PR_TRACE, "Hello World");
 	assert(console_buffer[0] == 0);
 
-	// Should not be flushed to console
-	prlog(PR_DEBUG, "Hello World");
-	assert(strcmp(console_buffer, "[    0.000000042,7] Hello World") == 0);
-	assert(flushed_to_drivers==false);
-
 	printf("Hello World");
 	assert(strcmp(console_buffer, "[    0.000000042,5] Hello World") == 0);
-	assert(flushed_to_drivers==true);
 
 	return 0;
 }
diff --git a/include/console.h b/include/console.h
index b726251fc5f2..1986e988974c 100644
--- a/include/console.h
+++ b/include/console.h
@@ -86,7 +86,7 @@ extern void console_complete_flush(void);
 extern size_t mambo_console_write(const char *buf, size_t count);
 extern void enable_mambo_console(void);
 
-ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count);
+ssize_t console_write(const void *buf, size_t count);
 
 extern void clear_console(void);
 extern void memcons_add_properties(void);
-- 
2.7.4



More information about the Skiboot mailing list