summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2018-09-03 15:10:56 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-18 16:07:23 +0200
commit427c8ae9bebc484080b00523b434c98c23135088 (patch)
treef4ebe4a1e25e832a62887cf60ca9d4506a59cf59 /drivers
parent10a5315b47b09ea3c8e69e5bb5b51a829fe84028 (diff)
downloadlinux-427c8ae9bebc484080b00523b434c98c23135088.tar.bz2
serial: uartps: Change logic how console_port is setup
Change logic how console_port is setup by using CON_ENABLED flag instead of index. There will be unique cdns_uart_console() structures that's why code can't use id for console_port assignment. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/xilinx_uartps.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 945d252b93e3..654a54a32f10 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1533,7 +1533,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
* If register_console() don't assign value, then console_port pointer
* is cleanup.
*/
- if (cdns_uart_uart_driver.cons->index == -1)
+ if (!console_port)
console_port = port;
#endif
@@ -1546,7 +1546,8 @@ static int cdns_uart_probe(struct platform_device *pdev)
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
/* This is not port which is used for console that's why clean it up */
- if (cdns_uart_uart_driver.cons->index == -1)
+ if (console_port == port &&
+ !(cdns_uart_uart_driver.cons->flags & CON_ENABLED))
console_port = NULL;
#endif
@@ -1595,6 +1596,12 @@ static int cdns_uart_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
+
+#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
+ if (console_port == port)
+ console_port = NULL;
+#endif
+
if (!--instances)
uart_unregister_driver(cdns_uart_data->cdns_uart_driver);
return rc;