[Skiboot] [PATCH 6/6] console: excise flush_to_drivers
Oliver O'Halloran
oohall at gmail.com
Mon Jun 19 16:01:38 AEST 2017
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 | 20 +++++---------------
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(+), 50 deletions(-)
diff --git a/core/console-log.c b/core/console-log.c
index 0b8cef53fc64..bf000a92b4e9 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 fbab5a38e21e..b5679d77695c 100644
--- a/core/console.c
+++ b/core/console.c
@@ -143,7 +143,7 @@ static int parse_loghdr(int start, int *log_level)
* 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();
@@ -179,16 +179,6 @@ static bool __flush_console(bool flush_to_drivers __unused)
in_flush = true;
- /*
- * NB: this must appear after the in_flush check since it modifies
- * con_out.
- */
- if (!flush_to_drivers) {
- con_out = con_in;
- in_flush = false;
- return false;
- }
-
do {
int start, req, len, log_lvl;
@@ -234,7 +224,7 @@ bool flush_console(void)
bool ret;
lock(&con_lock);
- ret = __flush_console(true);
+ ret = __flush_console();
unlock(&con_lock);
return ret;
@@ -293,7 +283,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
@@ -308,7 +298,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);
@@ -318,7 +308,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 33db0460da8f..3c74b0eaab6d 100644
--- a/core/test/run-console-flush.c
+++ b/core/test/run-console-flush.c
@@ -108,7 +108,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 708b696bf03e..9783e4dee2e3 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.9.3
More information about the Skiboot
mailing list