Re: [Qemu-devel] [PATCH v1 3/3] char/serial: serial_ioport_write: Factor out common code

2013-06-10 Thread Andreas Färber
Am 03.06.2013 07:14, schrieb peter.crosthwa...@xilinx.com:
 From: Peter Crosthwaite peter.crosthwa...@xilinx.com
 
 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-triv...@nongnu.org
 
 Signed-off-by: Peter Crosthwaite peter.crosthwa...@xilinx.com

Reviewed-by: Andreas Färber afaer...@suse.de

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



[Qemu-devel] [PATCH v1 3/3] char/serial: serial_ioport_write: Factor out common code

2013-06-02 Thread peter . crosthwaite
From: Peter Crosthwaite peter.crosthwa...@xilinx.com

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-triv...@nongnu.org

Signed-off-by: Peter Crosthwaite peter.crosthwa...@xilinx.com
---

 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 0a2b6c9..017610e 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -285,15 +285,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.rc1.44.gb387c77.dirty