From 5114efc4a077a1fdfa9873e6f44a00d5f8101f65 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 19 May 2017 00:35:08 +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: <20170519003523.21163-4-famz@redhat.com> Patchwork-id: 75357 O-Subject: [RHEL-7.3.z qemu-kvm PATCH 03/18] char/serial: serial_ioport_write: Factor out common code Bugzilla: 1452332 RH-Acked-by: Paolo Bonzini RH-Acked-by: Laurent Vivier 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