summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorDong Aisheng <aisheng.dong@nxp.com>2017-09-05 16:31:50 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit0e694c16661bcedf7a6759d9ad82eca337331d4d (patch)
tree02125385d0344ef873a98a1159ad2b9851456614 /drivers/tty/serial
parent18e53f2c35662a4900add5e7cf3b354c7762def9 (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/serial')
-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 7655b0d651db..eb6b6f0aeae5 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;
}
}