Skip to content

Commit 0be160c

Browse files
fancergregkh
authored andcommitted
serial: 8250_dw: Pass the same rate to the clk round and set rate methods
Indeed according to the clk API if clk_round_rate() has successfully accepted a rate, then in order setup the clock with value returned by the clk_round_rate() the clk_set_rate() method must be called with the original rate value. Suggested-by: Russell King <[email protected]> Signed-off-by: Serge Semin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 442fdef commit 0be160c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/tty/serial/8250/8250_dw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,15 @@ dw8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old)
275275
static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
276276
struct ktermios *old)
277277
{
278-
unsigned int baud = tty_termios_baud_rate(termios);
278+
unsigned long newrate = tty_termios_baud_rate(termios) * 16;
279279
struct dw8250_data *d = to_dw8250_data(p->private_data);
280280
long rate;
281281
int ret;
282282

283283
clk_disable_unprepare(d->clk);
284-
rate = clk_round_rate(d->clk, baud * 16);
284+
rate = clk_round_rate(d->clk, newrate);
285285
if (rate > 0) {
286-
ret = clk_set_rate(d->clk, rate);
286+
ret = clk_set_rate(d->clk, newrate);
287287
if (!ret)
288288
p->uartclk = rate;
289289
}

0 commit comments

Comments
 (0)