All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, keir@xen.org
Subject: Re: [PATCH] V2 pci uart - better cope with UART being temporarily unavailable
Date: Tue, 27 Aug 2013 15:36:39 +0200	[thread overview]
Message-ID: <521CAB67.3020409@citrix.com> (raw)
In-Reply-To: <521CB72B02000078000EEBE7@nat28.tlf.novell.com>


>> --- a/xen/drivers/char/serial.c
>> +++ b/xen/drivers/char/serial.c
>> @@ -111,15 +111,18 @@ static void __serial_putc(struct serial_port *port, char c)
>>               if ( port->tx_log_everything )
>>               {
>>                   /* Buffer is full: we spin waiting for space to appear. */
>> -                unsigned int n;
>> +                int n;
>>
>>                   while ( (n = port->driver->tx_ready(port)) == 0 )
>>                       cpu_relax();
>> -                while ( n-- )
>> -                    port->driver->putc(
>> -                        port,
>> -                        port->txbuf[mask_serial_txbuf_idx(port->txbufc++)]);
>> -                port->txbuf[mask_serial_txbuf_idx(port->txbufp++)] = c;
>> +                if (n>  0)
>> +                {
>> +                    while ( n-- )
> "while ( n-->  0 )" can achieve the same without the extra if()
> and with just a one line change.
Thanks for review - agree with most comments except this one, we need to 
avoid executing "port->txbuf[mask_serial_txbuf_idx(port->txbufp++)] = c" 
if port is offline, since in this case the while loop will not consume 
pull any character out of the buffer, and it will stay full, and we 
should just drop the char. The "if" I added pulled the buffer insert 
into its body.

  reply	other threads:[~2013-08-27 13:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27 10:15 [PATCH] V2 pci uart - better cope with UART being temporarily unavailable Tomasz Wroblewski
2013-08-27 12:26 ` Jan Beulich
2013-08-27 13:36   ` Tomasz Wroblewski [this message]
2013-08-27 13:58     ` Jan Beulich
2013-08-27 13:44   ` Tomasz Wroblewski
2013-08-27 13:59     ` Jan Beulich
2013-08-27 14:02       ` Tomasz Wroblewski

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=521CAB67.3020409@citrix.com \
    --to=tomasz.wroblewski@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.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.