summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorFrancesco Dolcini <francesco.dolcini@toradex.com>2021-10-20 21:26:43 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-21 10:30:08 +0200
commit9768a37cec37b03f745ce90f8c3d378e0aa223ae (patch)
tree0fe9799146f1216deaf50240d51fce1b1017b928 /drivers/tty
parent6d0d1b5a1b4870911beb89544ec1a9751c42fec7 (diff)
serial: imx: disable console clocks on unregister
During console setup imx_uart_console_setup() enables clocks, but they are never disabled when the console is unregistered, this leads to clk_prepare_enable() being called multiple times without a matching clk_disable_unprepare() in case of console unregister. Ensure that clock enable/disable are balanced adding clk_disable_unprepare() in the console exit callback. Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> Link: https://lore.kernel.org/r/20211020192643.476895-3-francesco.dolcini@toradex.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/imx.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 51a9f9423b1a..90f82e6c54e4 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2124,12 +2124,24 @@ error_console:
return retval;
}
+static int
+imx_uart_console_exit(struct console *co)
+{
+ struct imx_port *sport = imx_uart_ports[co->index];
+
+ clk_disable_unprepare(sport->clk_per);
+ clk_disable_unprepare(sport->clk_ipg);
+
+ return 0;
+}
+
static struct uart_driver imx_uart_uart_driver;
static struct console imx_uart_console = {
.name = DEV_NAME,
.write = imx_uart_console_write,
.device = uart_console_device,
.setup = imx_uart_console_setup,
+ .exit = imx_uart_console_exit,
.flags = CON_PRINTBUFFER,
.index = -1,
.data = &imx_uart_uart_driver,