From: Jason Wessel Date: Sun, 12 Aug 2012 12:16:43 +0000 (-0500) Subject: pmac_zilog,kdb: Fix console poll hook to return instead of loop X-Git-Tag: v3.6-rc3~37^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38f8eefccf3a23c4058a570fa2938a4f553cf8e0;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git pmac_zilog,kdb: Fix console poll hook to return instead of loop kdb <-> kgdb transitioning does not work properly with this UART driver because the get character routine loops indefinitely as opposed to returning NO_POLL_CHAR per the expectation of the KDB I/O driver API. The symptom is a kernel hang when trying to switch debug modes. Cc: Alan Cox Signed-off-by: Jason Wessel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 654755a..333c8d0 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c @@ -1348,10 +1348,16 @@ static int pmz_verify_port(struct uart_port *port, struct serial_struct *ser) static int pmz_poll_get_char(struct uart_port *port) { struct uart_pmac_port *uap = (struct uart_pmac_port *)port; + int tries = 2; - while ((read_zsreg(uap, R0) & Rx_CH_AV) == 0) - udelay(5); - return read_zsdata(uap); + while (tries) { + if ((read_zsreg(uap, R0) & Rx_CH_AV) != 0) + return read_zsdata(uap); + if (tries--) + udelay(5); + } + + return NO_POLL_CHAR; } static void pmz_poll_put_char(struct uart_port *port, unsigned char c)