linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv4 1/4] serial-uartlite: Change logic how console_port is setup
@ 2019-11-12 10:41 shubhrajyoti.datta
  2019-11-12 10:41 ` [PATCHv4 2/4] serial-uartlite: Use allocated structure instead of static ones shubhrajyoti.datta
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: shubhrajyoti.datta @ 2019-11-12 10:41 UTC (permalink / raw)
  To: linux-serial; +Cc: gregkh, jacmet, Shubhrajyoti Datta

From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

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>
---
v5: fix a compilation failure.

 drivers/tty/serial/uartlite.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 06e79c1..8b39b2b 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -665,7 +665,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
 
@@ -680,7 +680,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
 
@@ -864,6 +865,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);
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-13 11:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 10:41 [PATCHv4 1/4] serial-uartlite: Change logic how console_port is setup shubhrajyoti.datta
2019-11-12 10:41 ` [PATCHv4 2/4] serial-uartlite: Use allocated structure instead of static ones shubhrajyoti.datta
2019-11-12 10:41 ` [PATCHv4 3/4] serial-uartlite: Remove ULITE_NR_PORTS macro shubhrajyoti.datta
2019-11-12 10:41 ` [PATCHv4 4/4] serial: uartlite: Fix compilation issue on !OF platforms shubhrajyoti.datta
2019-11-13 11:23   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).