diff mbox series

[v2,4/4] xen/console: Simplify domU console handling in guest_console_write

Message ID 20190805132955.1630-5-julien.grall@arm.com (mailing list archive)
State New, archived
Headers show
Series xen/console: Bug fixes and doc improvement | expand

Commit Message

Julien Grall Aug. 5, 2019, 1:29 p.m. UTC
2 paths in the domU console handling are now the same. So they can be
merged to make the code simpler.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>

---
    Changes in v2:
        - Fix indentation
        - Add Stefano's reviewed-by
        - Add Wei's acked-by
---
 xen/drivers/char/console.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index fa8f5cff4b..4105ca58d8 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -585,13 +585,8 @@  static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer,
             *kout = '\0';
             spin_lock(&cd->pbuf_lock);
             kcount = kin - kbuf;
-            if ( c == '\n' )
-            {
-                cd->pbuf[cd->pbuf_idx] = '\0';
-                guest_printk(cd, XENLOG_G_DEBUG "%s%s\n", cd->pbuf, kbuf);
-                cd->pbuf_idx = 0;
-            }
-            else if ( cd->pbuf_idx + (kout - kbuf) < (DOMAIN_PBUF_SIZE - 1) )
+            if ( c != '\n' &&
+                 (cd->pbuf_idx + (kout - kbuf) < (DOMAIN_PBUF_SIZE - 1)) )
             {
                 /* buffer the output until a newline */
                 memcpy(cd->pbuf + cd->pbuf_idx, kbuf, kout - kbuf);