提交 7f4f0a22 编写于 作者: P Peter Crosthwaite 提交者: Michael Tokarev

char/serial: cosmetic fixes.

Some cosmetic fixes to char/serial fixing some checkpatch errors.

Cc: qemu-trivial@nongnu.org
Signed-off-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: NAndreas Färber <afaerber@suse.de>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 9e5e2b23
...@@ -263,8 +263,9 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque) ...@@ -263,8 +263,9 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
if (s->tsr_retry <= 0) { if (s->tsr_retry <= 0) {
if (s->fcr & UART_FCR_FE) { if (s->fcr & UART_FCR_FE) {
s->tsr = fifo_get(s,XMIT_FIFO); s->tsr = fifo_get(s,XMIT_FIFO);
if (!s->xmit_fifo.count) if (!s->xmit_fifo.count) {
s->lsr |= UART_LSR_THRE; s->lsr |= UART_LSR_THRE;
}
} else if ((s->lsr & UART_LSR_THRE)) { } else if ((s->lsr & UART_LSR_THRE)) {
return FALSE; return FALSE;
} else { } else {
...@@ -461,10 +462,11 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size) ...@@ -461,10 +462,11 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
} else { } else {
if(s->fcr & UART_FCR_FE) { if(s->fcr & UART_FCR_FE) {
ret = fifo_get(s,RECV_FIFO); ret = fifo_get(s,RECV_FIFO);
if (s->recv_fifo.count == 0) if (s->recv_fifo.count == 0) {
s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); s->lsr &= ~(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); qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4);
}
s->timeout_ipending = 0; s->timeout_ipending = 0;
} else { } else {
ret = s->rbr; ret = s->rbr;
...@@ -534,15 +536,21 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size) ...@@ -534,15 +536,21 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
static int serial_can_receive(SerialState *s) static int serial_can_receive(SerialState *s)
{ {
if(s->fcr & UART_FCR_FE) { if(s->fcr & UART_FCR_FE) {
if(s->recv_fifo.count < UART_FIFO_LENGTH) 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, * Advertise (fifo.itl - fifo.count) bytes when count < ITL, and 1
effectively overriding the ITL that the guest has set. */ * if above. If UART_FIFO_LENGTH - fifo.count is advertised the
return (s->recv_fifo.count <= s->recv_fifo.itl) ? s->recv_fifo.itl - s->recv_fifo.count : 1; * effect will be to almost always fill the fifo completely before
else * the guest has a chance to respond, effectively overriding the ITL
return 0; * that the guest has set.
*/
return (s->recv_fifo.count <= s->recv_fifo.itl) ?
s->recv_fifo.itl - s->recv_fifo.count : 1;
} else {
return 0;
}
} else { } else {
return !(s->lsr & UART_LSR_DR); return !(s->lsr & UART_LSR_DR);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册