From 685401356afb12cbe8c2102fad49565e25cdce40 Mon Sep 17 00:00:00 2001 From: Dong Aisheng Date: Tue, 5 Sep 2017 16:31:50 +0800 Subject: [PATCH] MLK-17491-2 serial: fsl_lpuart: improve the baud setting algorithm If "baud_diff == 0", it means we already found the exact matching baud rate and no need try looping the left possible baud rates anymore. So in this patch, we break out immediately once we find the right baud rate to avoid the left meaningless loops. Acked-by: Fugang Duan Signed-off-by: Dong Aisheng --- drivers/tty/serial/fsl_lpuart.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 20d675b65583..4b6c78b2def7 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1661,6 +1661,9 @@ lpuart32_serial_setbrg(struct lpuart_port *sport, unsigned int baudrate) baud_diff = tmp_diff; osr = tmp_osr; sbr = tmp_sbr; + + if (!baud_diff) + break; } } -- 2.17.1