|
|
9ae3a8 |
From 63857964e14bbf4bcb91eaa56ca46a30d14934ed Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 18 May 2017 09:21:19 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 06/18] char/serial: Fix emptyness handling
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20170518092131.16571-7-famz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 75298
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.4 qemu-kvm PATCH v3 06/18] char/serial: Fix emptyness handling
|
|
|
9ae3a8 |
Bugzilla: 1451470
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Don Slutz <dslutz@verizon.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The commit 88c1ee73d3231c74ff90bcfc084a7589670ec244
|
|
|
9ae3a8 |
char/serial: Fix emptyness check
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Still causes extra NULL byte(s) to be sent.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
So if the fifo is empty, do not send an extra NULL byte.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
|
|
|
9ae3a8 |
Signed-off-by: Don Slutz <dslutz@verizon.com>
|
|
|
9ae3a8 |
Message-id: 1395160174-16006-1-git-send-email-dslutz@verizon.com
|
|
|
9ae3a8 |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
9ae3a8 |
(cherry picked from commit dffacd4654ec8bf2898aed230852154c6ed755ed)
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/char/serial.c | 6 ++++--
|
|
|
9ae3a8 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/char/serial.c b/hw/char/serial.c
|
|
|
9ae3a8 |
index 489a885..e020b0e 100644
|
|
|
9ae3a8 |
--- a/hw/char/serial.c
|
|
|
9ae3a8 |
+++ b/hw/char/serial.c
|
|
|
9ae3a8 |
@@ -225,8 +225,10 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (s->tsr_retry <= 0) {
|
|
|
9ae3a8 |
if (s->fcr & UART_FCR_FE) {
|
|
|
9ae3a8 |
- s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
|
|
|
9ae3a8 |
- 0 : fifo8_pop(&s->xmit_fifo);
|
|
|
9ae3a8 |
+ if (fifo8_is_empty(&s->xmit_fifo)) {
|
|
|
9ae3a8 |
+ return FALSE;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ s->tsr = fifo8_pop(&s->xmit_fifo);
|
|
|
9ae3a8 |
if (!s->xmit_fifo.num) {
|
|
|
9ae3a8 |
s->lsr |= UART_LSR_THRE;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|