diff options
author | Stefan Agner <stefan@agner.ch> | 2018-11-14 16:34:40 +0100 |
---|---|---|
committer | Stefan Agner <stefan@agner.ch> | 2019-01-11 22:06:48 +0100 |
commit | 7d19ec62345192bd90122670f4a16f0441808f75 (patch) | |
tree | 36ee6f091f58e0671e7a3c05ccb61e390478a538 /drivers/tty | |
parent | 48c95968741d99fd7fd8a67e68e0689e38440784 (diff) |
serial: imx: unprepare console clocks on remove
Currently imx_uart_console_setup() prepares clocks which do not
get unprepared anywhere. Check whether the console has been used
by testing if index is set and unprepare clocks in this case.
This makes sure that clocks are properly unprepared after the
console device has been unbound.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/imx.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index dff75dc94731..2c7af2d8d142 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2081,7 +2081,7 @@ static struct console imx_uart_console = { .data = &imx_uart_uart_driver, }; -#define IMX_CONSOLE &imx_uart_console +#define IMX_CONSOLE (&imx_uart_console) #ifdef CONFIG_OF static void imx_uart_console_early_putchar(struct uart_port *port, int ch) @@ -2374,8 +2374,17 @@ static int imx_uart_probe(struct platform_device *pdev) static int imx_uart_remove(struct platform_device *pdev) { struct imx_port *sport = platform_get_drvdata(pdev); + int ret; + + ret = uart_remove_one_port(&imx_uart_uart_driver, &sport->port); + + if (IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE) && IMX_CONSOLE->index >= 0) { + clk_unprepare(sport->clk_ipg); + clk_unprepare(sport->clk_per); + IMX_CONSOLE->index = -1; + } - return uart_remove_one_port(&imx_uart_uart_driver, &sport->port); + return ret; } static void imx_uart_restore_context(struct imx_port *sport) |