serial: sh-sci: Merge sci_scbrr_calc() and sci_baud_calc_hscif()
commitb4a5c459088b724734573a550c9da42a9a19c9d0
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 16 Nov 2015 16:22:16 +0000 (16 17:22 +0100)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 17 Dec 2015 10:18:38 +0000 (17 11:18 +0100)
treea56138443acd167edb8faf05ffc2a15e65fb0861
parent6c51332dfc23fc7c2c58244e35d36744db202077
serial: sh-sci: Merge sci_scbrr_calc() and sci_baud_calc_hscif()

For low bit rates, the for-loop that reduces the divider returned by
sci_scbrr_calc() and picks the clock select value may terminate without
finding suitable values, leading to out-of-range divider and clock
select values.
sci_baud_calc_hscif() doesn't suffer from this problem, as it correctly
uses clamp().

Since there are only two relevant differences between HSCIF and other
variants w.r.t. bit rate configuration (fixed vs. variable sample rate,
and an additional factor of two), sci_scbrr_calc() and
sci_baud_calc_hscif() can be merged, fixing the issue with out-of-range
values.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c