提交 de6d6b89 编写于 作者: G Geert Uytterhoeven 提交者: Greg Kroah-Hartman

serial: sh-sci: Fix HSCIF RX sampling point adjustment

commit 6b87784b53592a90d21576be8eff688b56d93cce upstream.

The calculation of the sampling point has min() and max() exchanged.
Fix this by using the clamp() helper instead.

Fixes: 63ba1e00 ("serial: sh-sci: Support for HSCIF RX sampling point adjustment")
Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: NUlrich Hecht <uli+renesas@fpond.eu>
Reviewed-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: NDirk Behme <dirk.behme@de.bosch.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: NSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 ec96f65e
......@@ -2504,7 +2504,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
* last stop bit; we can increase the error
* margin by shifting the sampling point.
*/
int shift = min(-8, max(7, deviation / 2));
int shift = clamp(deviation / 2, -8, 7);
hssrr |= (shift << HSCIF_SRHP_SHIFT) &
HSCIF_SRHP_MASK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册