Skip to contentSkip to conversation

serial: sunhv: Initialize lock for non-registered console

PATCH In review Andy Shevchenko 3 participants 5 messages Apr 2, 2020 – Apr 6, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: sunhv: Initialize lock for non-registered console

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")
Cc David Miller <[email protected]>
---
 drivers/tty/serial/sunhv.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/sunhv.c +3 -0
index eafada8fb6fa..e35073e93a5b 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 11 lines · Andy Shevchenko

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.

Quoted 7 lines
Fixes a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Cc David Miller <[email protected]>
---
 drivers/tty/serial/sunhv.c | 3 +++
 1 file changed, 3 insertions(+)

Thanks, will pick this up after -rc1 is out.

greg k-h

#2 lore raw
In reply to Andy Shevchenko
Quoted 12 lines · Andy Shevchenko

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.

Quoted 7 lines
Fixes a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Cc David Miller <[email protected]>
---
 drivers/tty/serial/sunhv.c | 3 +++
 1 file changed, 3 insertions(+)

fixes issue for me, sorry for the late testing

#3 lore raw
Quoted 23 lines · Anatoly Pugachev
Quoted 12 lines · Andy Shevchenko

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.

Quoted 7 lines
Fixes a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Cc David Miller <[email protected]>
---
 drivers/tty/serial/sunhv.c | 3 +++
 1 file changed, 3 insertions(+)
Quoted 1 line

fixes issue for me, sorry for the late testing

Thank you! Can you formally provide a Tested-by tag?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines

fixes issue for me, sorry for the late testing

Thank you! Can you formally provide a Tested-by tag?

Andy,

up to you actually to add needed tags. Thanks.

But anyway,