All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: peter.crosthwaite@xilinx.com
Cc: qemu-trivial@nongnu.org, edgar.iglesias@gmail.com,
	aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH v1 1/3] char/serial: cosmetic fixes.
Date: Mon, 10 Jun 2013 15:32:43 +0200	[thread overview]
Message-ID: <51B5D57B.7040006@suse.de> (raw)
In-Reply-To: <b61bfd22e26fd08d9cca73e875c6074a9664c49c.1370236013.git.peter.crosthwaite@xilinx.com>

Hi Peter,

Am 03.06.2013 07:12, schrieb peter.crosthwaite@xilinx.com:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> 
> Some cosmetic fixes to char/serial fixing some checkpatch errors.
> 
> Cc: qemu-trivial@nongnu.org
> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> Needed for the next patch to pass checkpatch. Done as sep patch to not
> obscure that patch.
> 
>  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, GIOCondition cond, void *opaque)
>      if (s->tsr_retry <= 0) {
>          if (s->fcr & UART_FCR_FE) {
>              s->tsr = fifo_get(s,XMIT_FIFO);
> -            if (!s->xmit_fifo.count)
> +            if (!s->xmit_fifo.count) {
>                  s->lsr |= 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, hwaddr addr, unsigned size)
>          } else {
>              if(s->fcr & UART_FCR_FE) {
>                  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);
> -                else
> +                } else {
>                      qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4);

Wanna rebreak this one too in case you respin/pull?

> +                }
>                  s->timeout_ipending = 0;
>              } else {
>                  ret = s->rbr;
> @@ -534,15 +536,21 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr 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 completely before the guest has a chance to respond,
> -        effectively overriding the ITL 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;
> +        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 <= s->recv_fifo.itl) ?
> +                        s->recv_fifo.itl - s->recv_fifo.count : 1;

Here I stumbled over the indentation being 5 chars from '(' or 4 chars
within, but the latter doesn't make sense since it's terminated before.
I would've expected 4 chars from block or aligned below '(' or
4-char-indented from there. But I'm not sure if there are any clear
recommendations, so since it's apparently not using tabs (my initial
suspicion), no objection.

Cheers,
Andreas

> +        } else {
> +            return 0;
> +        }
>      } else {
> -    return !(s->lsr & UART_LSR_DR);
> +        return !(s->lsr & UART_LSR_DR);
>      }
>  }
>  
> 


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


WARNING: multiple messages have this Message-ID (diff)
From: "Andreas Färber" <afaerber@suse.de>
To: peter.crosthwaite@xilinx.com
Cc: qemu-trivial@nongnu.org, edgar.iglesias@gmail.com,
	aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1 1/3] char/serial: cosmetic fixes.
Date: Mon, 10 Jun 2013 15:32:43 +0200	[thread overview]
Message-ID: <51B5D57B.7040006@suse.de> (raw)
In-Reply-To: <b61bfd22e26fd08d9cca73e875c6074a9664c49c.1370236013.git.peter.crosthwaite@xilinx.com>

Hi Peter,

Am 03.06.2013 07:12, schrieb peter.crosthwaite@xilinx.com:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> 
> Some cosmetic fixes to char/serial fixing some checkpatch errors.
> 
> Cc: qemu-trivial@nongnu.org
> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> Needed for the next patch to pass checkpatch. Done as sep patch to not
> obscure that patch.
> 
>  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, GIOCondition cond, void *opaque)
>      if (s->tsr_retry <= 0) {
>          if (s->fcr & UART_FCR_FE) {
>              s->tsr = fifo_get(s,XMIT_FIFO);
> -            if (!s->xmit_fifo.count)
> +            if (!s->xmit_fifo.count) {
>                  s->lsr |= 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, hwaddr addr, unsigned size)
>          } else {
>              if(s->fcr & UART_FCR_FE) {
>                  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);
> -                else
> +                } else {
>                      qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4);

Wanna rebreak this one too in case you respin/pull?

> +                }
>                  s->timeout_ipending = 0;
>              } else {
>                  ret = s->rbr;
> @@ -534,15 +536,21 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr 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 completely before the guest has a chance to respond,
> -        effectively overriding the ITL 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;
> +        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 <= s->recv_fifo.itl) ?
> +                        s->recv_fifo.itl - s->recv_fifo.count : 1;

Here I stumbled over the indentation being 5 chars from '(' or 4 chars
within, but the latter doesn't make sense since it's terminated before.
I would've expected 4 chars from block or aligned below '(' or
4-char-indented from there. But I'm not sure if there are any clear
recommendations, so since it's apparently not using tabs (my initial
suspicion), no objection.

Cheers,
Andreas

> +        } else {
> +            return 0;
> +        }
>      } else {
> -    return !(s->lsr & UART_LSR_DR);
> +        return !(s->lsr & UART_LSR_DR);
>      }
>  }
>  
> 


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

  reply	other threads:[~2013-06-10 13:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03  5:11 [Qemu-devel] [PATCH v1 0/3] Serial cleanup peter.crosthwaite
2013-06-03  5:12 ` [Qemu-trivial] [PATCH v1 1/3] char/serial: cosmetic fixes peter.crosthwaite
2013-06-03  5:12   ` [Qemu-devel] " peter.crosthwaite
2013-06-10 13:32   ` Andreas Färber [this message]
2013-06-10 13:32     ` Andreas Färber
2013-06-10 15:17   ` [Qemu-trivial] " Michael Tokarev
2013-06-10 15:17     ` [Qemu-devel] " Michael Tokarev
2013-06-10 15:29     ` Michael Tokarev
2013-06-10 15:29       ` [Qemu-devel] " Michael Tokarev
2013-06-10 22:24       ` [Qemu-trivial] [Qemu-devel] " Peter Crosthwaite
2013-06-10 22:24         ` [Qemu-devel] [Qemu-trivial] " Peter Crosthwaite
2013-06-03  5:13 ` [Qemu-devel] [PATCH v1 2/3] char/serial: Use generic Fifo8 peter.crosthwaite
2013-06-03  5:14 ` [Qemu-trivial] [PATCH v1 3/3] char/serial: serial_ioport_write: Factor out common code peter.crosthwaite
2013-06-03  5:14   ` [Qemu-devel] " peter.crosthwaite
2013-06-10 13:35   ` [Qemu-trivial] " Andreas Färber
2013-06-10 13:35     ` Andreas Färber
2013-06-10 10:23 ` [Qemu-trivial] [PATCH v1 0/3] Serial cleanup Peter Crosthwaite
2013-06-10 10:23   ` [Qemu-devel] " Peter Crosthwaite
2013-06-10 11:49   ` [Qemu-trivial] " Andreas Färber
2013-06-10 11:49     ` Andreas Färber
2013-06-10 12:09     ` [Qemu-trivial] " Peter Crosthwaite
2013-06-10 12:09       ` Peter Crosthwaite
2013-06-11 11:23   ` [Qemu-trivial] " Michael Tokarev
2013-06-11 11:23     ` [Qemu-devel] " Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B5D57B.7040006@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.