Skip to content

Commit 9e7b399

Browse files
Eduardo Valentingregkh
authored andcommitted
serial: imx: remove unbalanced clk_prepare
The current code attempts to prepare clk_per and clk_ipg before using the device. However, the result is an extra prepare call on each clock. Here is the output of uart clocks (only uart enabled and used as console): $ grep uart /sys/kernel/debug/clk/clk_summary uart_serial 1 2 80000000 0 0 uart 1 2 66000000 0 0 This patch balances the calls of prepares. The result is: $ grep uart /sys/kernel/debug/clk/clk_summary uart_serial 1 1 80000000 0 0 uart 1 1 66000000 0 0 Cc: Fabio Estevam <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Eduardo Valentin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent eafb9ee commit 9e7b399

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

drivers/tty/serial/imx.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,12 +1630,12 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
16301630
int locked = 1;
16311631
int retval;
16321632

1633-
retval = clk_enable(sport->clk_per);
1633+
retval = clk_prepare_enable(sport->clk_per);
16341634
if (retval)
16351635
return;
1636-
retval = clk_enable(sport->clk_ipg);
1636+
retval = clk_prepare_enable(sport->clk_ipg);
16371637
if (retval) {
1638-
clk_disable(sport->clk_per);
1638+
clk_disable_unprepare(sport->clk_per);
16391639
return;
16401640
}
16411641

@@ -1674,8 +1674,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
16741674
if (locked)
16751675
spin_unlock_irqrestore(&sport->port.lock, flags);
16761676

1677-
clk_disable(sport->clk_ipg);
1678-
clk_disable(sport->clk_per);
1677+
clk_disable_unprepare(sport->clk_ipg);
1678+
clk_disable_unprepare(sport->clk_per);
16791679
}
16801680

16811681
/*
@@ -1776,15 +1776,7 @@ imx_console_setup(struct console *co, char *options)
17761776

17771777
retval = uart_set_options(&sport->port, co, baud, parity, bits, flow);
17781778

1779-
clk_disable(sport->clk_ipg);
1780-
if (retval) {
1781-
clk_unprepare(sport->clk_ipg);
1782-
goto error_console;
1783-
}
1784-
1785-
retval = clk_prepare(sport->clk_per);
1786-
if (retval)
1787-
clk_disable_unprepare(sport->clk_ipg);
1779+
clk_disable_unprepare(sport->clk_ipg);
17881780

17891781
error_console:
17901782
return retval;

0 commit comments

Comments
 (0)