diff mbox series

[v2,1/4] xen: use common output function in debugtrace

Message ID 20190801101333.9821-2-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: debugtrace cleanup and per-cpu buffer support | expand

Commit Message

Jürgen Groß Aug. 1, 2019, 10:13 a.m. UTC
Today dumping the debugtrace buffers is done via sercon_puts(), while
direct printing of trace entries (after toggling output to the console)
is using serial_puts().

Use sercon_puts() in both cases, as the difference between both is not
really making sense.

In order to prepare moving debugtrace functionality to an own source
file rename sercon_puts() to console_serial_puts() and make it globally
visible.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/drivers/char/console.c | 16 ++++++++--------
 xen/include/xen/console.h  |  3 +++
 2 files changed, 11 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index d728e737d1..49fbbed21a 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -346,7 +346,7 @@  void console_giveback(int id)
         serial_steal_fn = NULL;
 }
 
-static void sercon_puts(const char *s)
+void console_serial_puts(const char *s)
 {
     if ( serial_steal_fn != NULL )
         (*serial_steal_fn)(s);
@@ -389,7 +389,7 @@  static void dump_console_ring_key(unsigned char key)
     }
     buf[sofar] = '\0';
 
-    sercon_puts(buf);
+    console_serial_puts(buf);
     video_puts(buf);
 
     free_xenheap_pages(buf, order);
@@ -548,7 +548,7 @@  static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
             /* Use direct console output as it could be interactive */
             spin_lock_irq(&console_lock);
 
-            sercon_puts(kbuf);
+            console_serial_puts(kbuf);
             video_puts(kbuf);
 
 #ifdef CONFIG_X86
@@ -669,7 +669,7 @@  static void __putstr(const char *str)
 {
     ASSERT(spin_is_locked(&console_lock));
 
-    sercon_puts(str);
+    console_serial_puts(str);
     video_puts(str);
 
 #ifdef CONFIG_X86
@@ -1182,11 +1182,11 @@  static void debugtrace_dump_worker(void)
 
     /* Print oldest portion of the ring. */
     ASSERT(debugtrace_buf[debugtrace_bytes - 1] == 0);
-    sercon_puts(&debugtrace_buf[debugtrace_prd]);
+    console_serial_puts(&debugtrace_buf[debugtrace_prd]);
 
     /* Print youngest portion of the ring. */
     debugtrace_buf[debugtrace_prd] = '\0';
-    sercon_puts(&debugtrace_buf[0]);
+    console_serial_puts(&debugtrace_buf[0]);
 
     memset(debugtrace_buf, '\0', debugtrace_bytes);
 
@@ -1267,8 +1267,8 @@  void debugtrace_printk(const char *fmt, ...)
     if ( debugtrace_send_to_console )
     {
         snprintf(cntbuf, sizeof(cntbuf), "%u ", ++count);
-        serial_puts(sercon_handle, cntbuf);
-        serial_puts(sercon_handle, buf);
+        console_serial_puts(cntbuf);
+        console_serial_puts(buf);
     }
     else
     {
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index b4f9463936..041522692f 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -46,6 +46,9 @@  void console_giveback(int id);
 int console_suspend(void);
 int console_resume(void);
 
+/* Emit a string via the serial console. */
+void console_serial_puts(const char *s);
+
 extern int8_t opt_console_xen;
 
 #endif /* __CONSOLE_H__ */