linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] serial: sunhv: Initialize lock for non-registered console
@ 2020-04-02 17:20 Andy Shevchenko
  2020-04-02 17:38 ` Greg Kroah-Hartman
  2020-04-04 17:50 ` Anatoly Pugachev
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-04-02 17:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-serial, sparclinux
  Cc: Andy Shevchenko, Anatoly Pugachev, David Miller

The commit a3cb39d258ef
("serial: core: Allow detach and attach serial device for console")
changed a bit logic behind lock initialization since for most of the console
driver it's supposed to have lock already initialized even if console is not
enabled. However, it's not the case for Sparc HV console.

Initialize lock explicitly in the ->probe().

Note, there is still an open question should or shouldn't not this driver
register console properly.

Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Reported-by: Anatoly Pugachev <matorola@gmail.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/sunhv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index eafada8fb6fa..e35073e93a5b 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -567,6 +567,9 @@ static int hv_probe(struct platform_device *op)
 	sunserial_console_match(&sunhv_console, op->dev.of_node,
 				&sunhv_reg, port->line, false);
 
+	/* We need to initialize lock even for non-registered console */
+	spin_lock_init(&port->lock);
+
 	err = uart_add_one_port(&sunhv_reg, port);
 	if (err)
 		goto out_unregister_driver;
-- 
2.25.1


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

end of thread, other threads:[~2020-04-06 10:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 17:20 [PATCH v1] serial: sunhv: Initialize lock for non-registered console Andy Shevchenko
2020-04-02 17:38 ` Greg Kroah-Hartman
2020-04-04 17:50 ` Anatoly Pugachev
2020-04-06 10:52   ` Andy Shevchenko
2020-04-06 10:57     ` Anatoly Pugachev

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).