Skip to content

Commit 0c727a4

Browse files
Fabio Estevamgregkh
authored andcommitted
Revert "serial: imx: remove unbalanced clk_prepare"
This reverts commit 9e7b399. Commit ("9e7b399d6528ea") causes the following warning and sometimes also hangs the system: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at kernel/locking/mutex.c:868 mutex_trylock+0x20c/0x22c() DEBUG_LOCKS_WARN_ON(in_interrupt()) Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.2.0-rc7-next-20150818-00001-g14418a6 #4 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) Backtrace: [<80012f08>] (dump_backtrace) from [<800130a4>] (show_stack+0x18/0x1c) r6:00000364 r5:00000000 r4:00000000 r3:00000000 [<8001308c>] (show_stack) from [<807902b8>] (dump_stack+0x88/0xa4) [<80790230>] (dump_stack) from [<8002a604>] (warn_slowpath_common+0x80/0xbc) r5:807945c4 r4:80ab3b50 [<8002a584>] (warn_slowpath_common) from [<8002a6e4>] (warn_slowpath_fmt+0x38/0x40) r8:00000000 r7:8131100c r6:8054c3cc r5:8131300c r4:80b0a570 [<8002a6b0>] (warn_slowpath_fmt) from [<807945c4>] (mutex_trylock+0x20c/0x22c) r3:8095d0d8 r2:8095ab28 [<807943b8>] (mutex_trylock) from [<8054c3cc>] (clk_prepare_lock+0x14/0xf4) r7:8131100c r6:be3f0c80 r5:00000037 r4:be3f0c80 [<8054c3b8>] (clk_prepare_lock) from [<8054dbfc>] (clk_prepare+0x18/0x30) r5:00000037 r4:be3f0c80 [<8054dbe4>] (clk_prepare) from [<8036a600>] (imx_console_write+0x30/0x244) r4:812d0bc8 r3:8132b9a4 To reproduce the problem we only need to let the board idle for something like 30 seconds. Tested on a imx6q-sabresd. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9ffecb1 commit 0c727a4

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

drivers/tty/serial/imx.c

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

1634-
retval = clk_prepare_enable(sport->clk_per);
1634+
retval = clk_enable(sport->clk_per);
16351635
if (retval)
16361636
return;
1637-
retval = clk_prepare_enable(sport->clk_ipg);
1637+
retval = clk_enable(sport->clk_ipg);
16381638
if (retval) {
1639-
clk_disable_unprepare(sport->clk_per);
1639+
clk_disable(sport->clk_per);
16401640
return;
16411641
}
16421642

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

1678-
clk_disable_unprepare(sport->clk_ipg);
1679-
clk_disable_unprepare(sport->clk_per);
1678+
clk_disable(sport->clk_ipg);
1679+
clk_disable(sport->clk_per);
16801680
}
16811681

16821682
/*
@@ -1777,7 +1777,15 @@ imx_console_setup(struct console *co, char *options)
17771777

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

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

17821790
error_console:
17831791
return retval;

0 commit comments

Comments
 (0)