summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorDong Aisheng <aisheng.dong@nxp.com>2017-09-05 16:31:50 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:30:30 +0800
commitb6a775fe05106075eff668edcd8c356a3a630593 (patch)
treef5871ee2f2b9fee308f94c4a9afedf4a675e7efc /drivers/tty
parentae5bed4ae61577ab66535a58f09df02aa77af987 (diff)
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 <fugang.duan@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/fsl_lpuart.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 8d7c809cf3a9..352b4f767c31 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1819,6 +1819,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;
}
}