diff options
Diffstat (limited to 'drivers/tty/serial/imx.c')
-rw-r--r-- | drivers/tty/serial/imx.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index dff75dc94731..af650ac68948 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1962,7 +1962,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) * If the port was already initialised (eg, by a boot loader), * try to determine the current setup. */ -static void __init +static void imx_uart_console_get_options(struct imx_port *sport, int *baud, int *parity, int *bits) { @@ -2021,7 +2021,7 @@ imx_uart_console_get_options(struct imx_port *sport, int *baud, } } -static int __init +static int imx_uart_console_setup(struct console *co, char *options) { struct imx_port *sport; @@ -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); - return 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 ret; } static void imx_uart_restore_context(struct imx_port *sport) |