]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
serial-uartlite: Change logic how console_port is setup
authorShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Thu, 4 Oct 2018 14:37:38 +0000 (20:07 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 7 Nov 2018 10:05:29 +0000 (11:05 +0100)
Change logic how console_port is setup by using CON_ENABLED flag
instead of index. There will be unique uart_console
structure that's why code can't use id for console_port
assignment.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/tty/serial/uartlite.c

index 41f5522c87c96dd0e575e94bd12fb3cbd319f5e8..1bb5e323bd271ef96458493d132b167b4ad95a7b 100644 (file)
@@ -668,7 +668,7 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq,
         * If register_console() don't assign value, then console_port pointer
         * is cleanup.
         */
-       if (ulite_uart_driver.cons->index == -1)
+       if (!console_port)
                console_port = port;
 #endif
 
@@ -683,7 +683,8 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq,
 
 #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
        /* This is not port which is used for console that's why clean it up */
-       if (ulite_uart_driver.cons->index == -1)
+       if (console_port == port &&
+           !(ulite_uart_driver->cons->flags & CON_ENABLED))
                console_port = NULL;
 #endif
 
@@ -862,6 +863,11 @@ static int ulite_remove(struct platform_device *pdev)
 
        clk_unprepare(pdata->clk);
        rc = ulite_release(&pdev->dev);
+#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
+       if (console_port == port)
+               console_port = NULL;
+#endif
+
        pm_runtime_disable(&pdev->dev);
        pm_runtime_set_suspended(&pdev->dev);
        pm_runtime_dont_use_autosuspend(&pdev->dev);