Skip to contentSkip to conversation

serial: imx: Initialize lock for non-registered console

PATCH In review Andy Shevchenko 3 participants 7 messages May 25, 2020

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

PATCH 1/1 serial: imx: 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 Freescale IMX 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")
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +3 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
 		}
 	}
 
+	/* We need to initialize lock even for non-registered console */
+	spin_lock_init(&sport->port.lock);
+
 	imx_uart_ports[sport->port.line] = sport;
 
 	platform_set_drvdata(pdev, sport);
Signature · 1 line
2.26.2
#1 lore raw
Quoted 6 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 Freescale IMX console.

Quoted 8 lines

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

I really wonder if this is the correct fix, especially since it looks like there are several other drivers which don't call register_console() either but implement a console device.

Guenter

Quoted 19 lines
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +3 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
 		}
 	}
 
+	/* We need to initialize lock even for non-registered console */
+	spin_lock_init(&sport->port.lock);
+
 	imx_uart_ports[sport->port.line] = sport;
 
 	platform_set_drvdata(pdev, sport);
#2 lore raw
Quoted 34 lines · Guenter Roeck
Quoted 6 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 Freescale IMX console.

Quoted 8 lines

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

I really wonder if this is the correct fix, especially since it looks like there are several other drivers which don't call register_console() either but implement a console device.

Guenter

Quoted 12 lines
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +0 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
 		}
 	}
 
Quoted 2 lines

drivers/tty/serial/imx.c static int imx_uart_probe(struct platform_device *pdev) · line 2408

Quoted 2 lines
drivers/tty/serial/imx.c +2 -0
+	/* We need to initialize lock even for non-registered console */
+	spin_lock_init(&sport->port.lock);

Why are we having to do this for all console drivers recently? Shouldn't the original patch that required this gone through and fixed up all drivers?

I'm with Guenter here, let's fix them all at once please.

thanks,

greg k-h

#3 lore raw
Quoted 35 lines · Greg Kroah-Hartman
Quoted 34 lines · Guenter Roeck
Quoted 6 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 Freescale IMX console.

Quoted 8 lines

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

I really wonder if this is the correct fix, especially since it looks like there are several other drivers which don't call register_console() either but implement a console device.

Guenter

Quoted 12 lines
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +0 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
 		}
 	}
 
Quoted 7 lines
Quoted 2 lines

drivers/tty/serial/imx.c static int imx_uart_probe(struct platform_device *pdev) · line 2408

Quoted 2 lines
drivers/tty/serial/imx.c +2 -0
+	/* We need to initialize lock even for non-registered console */
+	spin_lock_init(&sport->port.lock);

Why are we having to do this for all console drivers recently? Shouldn't the original patch that required this gone through and fixed up all drivers?

Good that I am getting paid for bisecting and reporting issues like this.

Oh, wait, I am not. Bummer.

Guenter

#4 lore raw
In reply to Greg Kroah-Hartman
Quoted 35 lines · Greg Kroah-Hartman
Quoted 34 lines · Guenter Roeck
Quoted 6 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 Freescale IMX console.

Quoted 8 lines

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

I really wonder if this is the correct fix, especially since it looks like there are several other drivers which don't call register_console() either but implement a console device.

Guenter

Quoted 12 lines
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +0 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
 		}
 	}
 
Quoted 8 lines
Quoted 2 lines

drivers/tty/serial/imx.c static int imx_uart_probe(struct platform_device *pdev) · line 2408

Quoted 2 lines
drivers/tty/serial/imx.c +2 -0
+	/* We need to initialize lock even for non-registered console */
+	spin_lock_init(&sport->port.lock);

Why are we having to do this for all console drivers recently? Shouldn't the original patch that required this gone through and fixed up all drivers?

I'm with Guenter here, let's fix them all at once please.

Okay. Do you want series per driver or one for all?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 43 lines · Andy Shevchenko
Quoted 42 lines · Greg Kroah-Hartman
Quoted 34 lines · Guenter Roeck
Quoted 6 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 Freescale IMX console.

Quoted 8 lines

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

I really wonder if this is the correct fix, especially since it looks like there are several other drivers which don't call register_console() either but implement a console device.

Guenter

Quoted 12 lines
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/imx.c +0 -0
index 986d902fb7fe..6b078e395931 100644
@@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev)
 		}
 	}
 
Quoted 2 lines

drivers/tty/serial/imx.c static int imx_uart_probe(struct platform_device *pdev) · line 2408

Quoted 2 lines
drivers/tty/serial/imx.c +2 -0
+	/* We need to initialize lock even for non-registered console */
+	spin_lock_init(&sport->port.lock);

Why are we having to do this for all console drivers recently? Shouldn't the original patch that required this gone through and fixed up all drivers?

Quoted 3 lines
Quoted 1 line

I'm with Guenter here, let's fix them all at once please.

Okay. Do you want series per driver or one for all?

one per driver is always easier to apply :)

thanks,

greg k-h

#6 lore raw
Quoted 3 lines · Greg Kroah-Hartman
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Greg Kroah-Hartman

On Mon, May 25, 2020 at 07:01:13AM -0700, Guenter Roeck wrote:

...

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I'm with Guenter here, let's fix them all at once please.

Okay. Do you want series per driver or one for all?

one per driver is always easier to apply :)

Will do during this week. Please, apply this one as it's ready to go.

Signature · 2 lines
With Best Regards,
Andy Shevchenko