|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] V2 pci uart - better cope with UART being temporarily unavailable
>>> On 27.08.13 at 15:36, Tomasz Wroblewski <tomasz.wroblewski@xxxxxxxxxx>
>>> wrote:
>>> --- 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.
Indeed. However, we're in a log-everything section, so dropping
characters here is not really right. Not sure what to do about this.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |