Skip to content

Commit d338838

Browse files
Shubhrajyoti Dattagregkh
authored andcommitted
serial-uartlite: 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 uart_console structure that's why code can't use id for console_port assignment. Signed-off-by: Shubhrajyoti Datta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7488754 commit d338838

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/tty/serial/uartlite.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq,
665665
* If register_console() don't assign value, then console_port pointer
666666
* is cleanup.
667667
*/
668-
if (ulite_uart_driver.cons->index == -1)
668+
if (!console_port)
669669
console_port = port;
670670
#endif
671671

@@ -680,7 +680,8 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq,
680680

681681
#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
682682
/* This is not port which is used for console that's why clean it up */
683-
if (ulite_uart_driver.cons->index == -1)
683+
if (console_port == port &&
684+
!(ulite_uart_driver.cons->flags & CON_ENABLED))
684685
console_port = NULL;
685686
#endif
686687

@@ -864,6 +865,11 @@ static int ulite_remove(struct platform_device *pdev)
864865

865866
clk_disable_unprepare(pdata->clk);
866867
rc = ulite_release(&pdev->dev);
868+
#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
869+
if (console_port == port)
870+
console_port = NULL;
871+
#endif
872+
867873
pm_runtime_disable(&pdev->dev);
868874
pm_runtime_set_suspended(&pdev->dev);
869875
pm_runtime_dont_use_autosuspend(&pdev->dev);

0 commit comments

Comments
 (0)