From e675e8ae59a4eb6a39fa9d1f13011fd4e718ce67 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Thu, 18 May 2017 09:21:16 +0200 Subject: [PATCH 03/18] char/serial: serial_ioport_write: Factor out common code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Fam Zheng Message-id: <20170518092131.16571-4-famz@redhat.com> Patchwork-id: 75295 O-Subject: [RHEL-7.4 qemu-kvm PATCH v3 03/18] char/serial: serial_ioport_write: Factor out common code Bugzilla: 1451470 RH-Acked-by: Paolo Bonzini RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Eduardo Habkost From: Peter Crosthwaite These three lines are common to both FIFO and regular mode. Just factor them out to outside the if rather than replicate the same lines inside both if and else. Cc: qemu-trivial@nongnu.org Signed-off-by: Peter Crosthwaite Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev (cherry picked from commit b5601df7624b461759651c49ac72a189951780b9) Signed-off-by: Fam Zheng Signed-off-by: Miroslav Rezanina --- hw/char/serial.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 0d4450e..72112cc 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -286,15 +286,11 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val, fifo8_pop(&s->xmit_fifo); } fifo8_push(&s->xmit_fifo, s->thr); - s->thr_ipending = 0; s->lsr &= ~UART_LSR_TEMT; - s->lsr &= ~UART_LSR_THRE; - serial_update_irq(s); - } else { - s->thr_ipending = 0; - s->lsr &= ~UART_LSR_THRE; - serial_update_irq(s); } + s->thr_ipending = 0; + s->lsr &= ~UART_LSR_THRE; + serial_update_irq(s); serial_xmit(NULL, G_IO_OUT, s); } break; -- 1.8.3.1