Hi Keir, Here''s a small sanity check fix for the recently added ns16550 polling support. If a device has a 1 byte tx fifo it''s not hard for the integer math to end up with a 0 timeout. Default to a 1ms timeout if this happens. Thanks, Alex Signed-off-by: Alex Williamson <alex.williamson@hp.com> --- diff -r f5b119533cc8 xen/drivers/char/ns16550.c --- a/xen/drivers/char/ns16550.c Thu Dec 1 14:22:22 2005 +++ b/xen/drivers/char/ns16550.c Thu Dec 1 09:28:48 2005 @@ -212,6 +212,8 @@ /* Polled mode. Calculate time to fill RX FIFO and/or empty TX FIFO. */ bits = uart->data_bits + uart->stop_bits + !!uart->parity; uart->timeout_ms = (bits * port->tx_fifo_size * 1000) / uart->baud; + if (!uart->timeout_ms) + uart->timeout_ms = 1; init_ac_timer(&uart->timer, ns16550_poll, port, 0); set_ac_timer(&uart->timer, NOW() + MILLISECS(uart->timeout_ms)); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Minor point, but please can you put [PATCH] in the subject line of posts containing patches. Thanks, Ian> Hi Keir, > > Here''s a small sanity check fix for the recently added > ns16550 polling support. If a device has a 1 byte tx fifo > it''s not hard for the integer math to end up with a 0 > timeout. Default to a 1ms timeout if this happens. Thanks, > > Alex > > Signed-off-by: Alex Williamson <alex.williamson@hp.com> > --- > > diff -r f5b119533cc8 xen/drivers/char/ns16550.c > --- a/xen/drivers/char/ns16550.c Thu Dec 1 14:22:22 2005 > +++ b/xen/drivers/char/ns16550.c Thu Dec 1 09:28:48 2005 > @@ -212,6 +212,8 @@ > /* Polled mode. Calculate time to fill RX FIFO > and/or empty TX FIFO. */ > bits = uart->data_bits + uart->stop_bits + !!uart->parity; > uart->timeout_ms = (bits * port->tx_fifo_size * > 1000) / uart->baud; > + if (!uart->timeout_ms) > + uart->timeout_ms = 1; > init_ac_timer(&uart->timer, ns16550_poll, port, 0); > set_ac_timer(&uart->timer, NOW() + > MILLISECS(uart->timeout_ms)); > } > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Alex Williamson
2005-Dec-01 22:00 UTC
RE: [Xen-devel] ns16550 polling timeout sanity check
On Thu, 2005-12-01 at 20:56 +0000, Ian Pratt wrote:> Minor point, but please can you put [PATCH] in the subject line of posts > containing patches.Sorry, first time in a while I''ve forgotten. I realized my mistake just moments after hitting send... oh well... Thanks, Alex -- Alex Williamson HP Linux & Open Source Lab _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel