summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu2014-11-19 23:58:27 +0100
committerGreg Kroah-Hartman2014-11-26 02:06:38 +0100
commitf53297fb99c8d2381a94cbaacc3e81c0c5db4cfd (patch)
tree73728cca8f60a61a20ff3a3395cd6ac1a3ebabe9
parentserial: sh-sci: Add device tree support for r7s72100 (diff)
downloadkernel-qcow2-linux-f53297fb99c8d2381a94cbaacc3e81c0c5db4cfd.tar.gz
kernel-qcow2-linux-f53297fb99c8d2381a94cbaacc3e81c0c5db4cfd.tar.xz
kernel-qcow2-linux-f53297fb99c8d2381a94cbaacc3e81c0c5db4cfd.zip
serial: sh-sci: Change checking for error rate of HSCIF
This changes negative values of error rate to be checked, because these values are valid as error rate. And this changes in the process of adopting a value close to 0. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/sh-sci.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index eb17c7124e72..fccebbdf449f 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1812,9 +1812,6 @@ static void sci_baud_calc_hscif(unsigned int bps, unsigned long freq,
err = DIV_ROUND_CLOSEST(freq, ((br + 1) * bps * sr *
(1 << (2 * c + 1)) / 1000)) -
1000;
- if (err < 0)
- continue;
-
/* Calc recv margin
* M: Receive margin (%)
* N: Ratio of bit rate to clock (N = sampling rate)
@@ -1829,7 +1826,7 @@ static void sci_baud_calc_hscif(unsigned int bps, unsigned long freq,
*/
recv_margin = abs((500 -
DIV_ROUND_CLOSEST(1000, sr << 1)) / 10);
- if (min_err > err) {
+ if (abs(min_err) > abs(err)) {
min_err = err;
recv_max_margin = recv_margin;
} else if ((min_err == err) &&