From: "Jan Beulich" Subject: [PATCH] ns16550: fix poll handling regression Date: Wed, 12 Oct 2011 16:39:55 +0100 Message-ID: <4E95D0EB020000780005AE7D@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Prior to c/s 23811:f1349a968a5a LSR_THRE was checked only once, while there it got promoted into the surrounding loop's condition. Since that bit may not clear for an extended period of time (i.e. when no new output is generated), it must not be used in this way indefinitely. Signed-off-by: Jan Beulich --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -157,15 +157,18 @@ static void __ns16550_poll(struct cpu_us { struct serial_port *port =3D this_cpu(poll_port); struct ns16550 *uart =3D port->uart; - char lsr; + unsigned char lsr, mask =3D LSR_DR | LSR_THRE; =20 if ( uart->intr_works ) return; /* Interrupts work - no more polling */ =20 - while ( (lsr =3D ns_read_reg(uart, LSR)) & (LSR_DR|LSR_THRE) ) + while ( (lsr =3D ns_read_reg(uart, LSR)) & mask ) { if ( lsr & LSR_THRE ) + { serial_tx_interrupt(port, regs); + mask &=3D ~LSR_THRE; + } if ( lsr & LSR_DR ) serial_rx_interrupt(port, regs); }