diff mbox

[4/6] serial: simplify tsr_retry reset

Message ID 1466432945-28682-5-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini June 20, 2016, 2:29 p.m. UTC
Move common code outside the if, and reset tsr_retry even in loopback mode.
Right now it cannot become non-zero, but it will be possible as soon as
we start respecting the baud rate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Dr. David Alan Gilbert June 22, 2016, 3:12 p.m. UTC | #1
* Paolo Bonzini (pbonzini@redhat.com) wrote:
> Move common code outside the if, and reset tsr_retry even in loopback mode.
> Right now it cannot become non-zero, but it will be possible as soon as
> we start respecting the baud rate.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hw/char/serial.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index 4196a2e..d232473 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -265,10 +265,8 @@ static void serial_xmit(SerialState *s)
>                  s->tsr_retry++;
>                  return;
>              }
> -            s->tsr_retry = 0;
> -        } else {
> -            s->tsr_retry = 0;
>          }
> +        s->tsr_retry = 0;
>  
>          /* Transmit another byte if it is already available. It is only
>             possible when FIFO is enabled and not empty. */
> -- 
> 2.5.5
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox

Patch

diff --git a/hw/char/serial.c b/hw/char/serial.c
index 4196a2e..d232473 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -265,10 +265,8 @@  static void serial_xmit(SerialState *s)
                 s->tsr_retry++;
                 return;
             }
-            s->tsr_retry = 0;
-        } else {
-            s->tsr_retry = 0;
         }
+        s->tsr_retry = 0;
 
         /* Transmit another byte if it is already available. It is only
            possible when FIFO is enabled and not empty. */