Patchwork [v2] cadence_uart: Handle backend tx errors

login
register
mail settings
Submitter Edgar Iglesias
Date June 19, 2013, 2:20 p.m.
Message ID <1371651629-31262-1-git-send-email-edgar.iglesias@gmail.com>
Download mbox | patch
Permalink /patch/252583/
State New
Headers show

Comments

Edgar Iglesias - June 19, 2013, 2:20 p.m.
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---

v1 -> v2:
Remove loop around qemu_chr_fe_write_all, it does not return short writes.

 hw/char/cadence_uart.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Peter Crosthwaite - June 20, 2013, 12:06 a.m.
On Thu, Jun 20, 2013 at 12:20 AM,  <edgar.iglesias@gmail.com> wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Thanks!

Regards,
Peter

> ---
>
> v1 -> v2:
> Remove loop around qemu_chr_fe_write_all, it does not return short writes.
>
>  hw/char/cadence_uart.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
> index c2a7834..205e125 100644
> --- a/hw/char/cadence_uart.c
> +++ b/hw/char/cadence_uart.c
> @@ -297,9 +297,7 @@ static void uart_write_tx_fifo(UartState *s, const uint8_t *buf, int size)
>          return;
>      }
>
> -    while (size) {
> -        size -= qemu_chr_fe_write(s->chr, buf, size);
> -    }
> +    qemu_chr_fe_write_all(s->chr, buf, size);
>  }
>
>  static void uart_receive(void *opaque, const uint8_t *buf, int size)
> --
> 1.7.10.4
>
>

Patch

diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index c2a7834..205e125 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -297,9 +297,7 @@  static void uart_write_tx_fifo(UartState *s, const uint8_t *buf, int size)
         return;
     }
 
-    while (size) {
-        size -= qemu_chr_fe_write(s->chr, buf, size);
-    }
+    qemu_chr_fe_write_all(s->chr, buf, size);
 }
 
 static void uart_receive(void *opaque, const uint8_t *buf, int size)