Received: from eggs.gnu.org ([2001:4830:134:3::10]:56914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnRi3-0006Lb-6E for qemu-devel@nongnu.org; Fri, 14 Jun 2013 06:58:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnRi0-0006eZ-EV for qemu-devel@nongnu.org; Fri, 14 Jun 2013 06:58:23 -0400 From: Michael Tokarev Date: Fri, 14 Jun 2013 14:50:23 +0400 Message-Id: <1371207042-17980-8-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1371207042-17980-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1371207042-17980-1-git-send-email-mjt@msgid.tls.msk.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 07/26] char/serial: cosmetic fixes. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-trivial@nongnu.org, Peter Crosthwaite , Michael Tokarev , qemu-devel@nongnu.org From: Peter Crosthwaite Some cosmetic fixes to char/serial fixing some checkpatch errors. Cc: qemu-trivial@nongnu.org Signed-off-by: Peter Crosthwaite Reviewed-by: Andreas F=C3=A4rber Signed-off-by: Michael Tokarev --- hw/char/serial.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 66b6348..bd6813e 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -263,8 +263,9 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCond= ition cond, void *opaque) if (s->tsr_retry <=3D 0) { if (s->fcr & UART_FCR_FE) { s->tsr =3D fifo_get(s,XMIT_FIFO); - if (!s->xmit_fifo.count) + if (!s->xmit_fifo.count) { s->lsr |=3D UART_LSR_THRE; + } } else if ((s->lsr & UART_LSR_THRE)) { return FALSE; } else { @@ -461,10 +462,11 @@ static uint64_t serial_ioport_read(void *opaque, hw= addr addr, unsigned size) } else { if(s->fcr & UART_FCR_FE) { ret =3D fifo_get(s,RECV_FIFO); - if (s->recv_fifo.count =3D=3D 0) + if (s->recv_fifo.count =3D=3D 0) { s->lsr &=3D ~(UART_LSR_DR | UART_LSR_BI); - else + } else { qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock= _ns (vm_clock) + s->char_transmit_time * 4); + } s->timeout_ipending =3D 0; } else { ret =3D s->rbr; @@ -534,15 +536,21 @@ static uint64_t serial_ioport_read(void *opaque, hw= addr addr, unsigned size) static int serial_can_receive(SerialState *s) { if(s->fcr & UART_FCR_FE) { - if(s->recv_fifo.count < UART_FIFO_LENGTH) - /* Advertise (fifo.itl - fifo.count) bytes when count < ITL, and= 1 if above. If UART_FIFO_LENGTH - fifo.count is - advertised the effect will be to almost always fill the fifo com= pletely before the guest has a chance to respond, - effectively overriding the ITL that the guest has set. */ - return (s->recv_fifo.count <=3D s->recv_fifo.itl) ? s->recv= _fifo.itl - s->recv_fifo.count : 1; - else - return 0; + if (s->recv_fifo.count < UART_FIFO_LENGTH) { + /* + * Advertise (fifo.itl - fifo.count) bytes when count < ITL,= and 1 + * if above. If UART_FIFO_LENGTH - fifo.count is advertised = the + * effect will be to almost always fill the fifo completely = before + * the guest has a chance to respond, effectively overriding= the ITL + * that the guest has set. + */ + return (s->recv_fifo.count <=3D s->recv_fifo.itl) ? + s->recv_fifo.itl - s->recv_fifo.count : 1; + } else { + return 0; + } } else { - return !(s->lsr & UART_LSR_DR); + return !(s->lsr & UART_LSR_DR); } } =20 --=20 1.7.10.4