Skip to contentSkip to conversation

serial: tegra: Only print FIFO error message when an error occurs

PATCH Superseded Jon Hunter 2 participants 3 messages Jun 30, 2021

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH 1/1 serial: tegra: Only print FIFO error message when an error occurs

The Tegra serial driver always prints an error message when enabling the FIFO for devices that have support for checking the FIFO enable status. Fix this by only display the error message, when an error occurs.

Fixes 222dcdff3405 ("serial: tegra: check for FIFO mode enabled status")
---
 drivers/tty/serial/serial-tegra.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/serial-tegra.c +3 -2
index 222032792d6c..cd481f7ba8eb 100644
@@ -1045,9 +1045,10 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
 
 	if (tup->cdata->fifo_mode_enable_status) {
 		ret = tegra_uart_wait_fifo_mode_enabled(tup);
-		dev_err(tup->uport.dev, "FIFO mode not enabled\n");
-		if (ret < 0)
+		if (ret < 0) {
+			dev_err(tup->uport.dev, "FIFO mode not enabled\n");
 			return ret;
+		}
 	} else {
 		/*
 		 * For all tegra devices (up to t210), there is a hardware
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Jon Hunter

The Tegra serial driver always prints an error message when enabling the FIFO for devices that have support for checking the FIFO enable status. Fix this by only display the error message, when an error occurs.

Fixes 222dcdff3405 ("serial: tegra: check for FIFO mode enabled status")
---
 drivers/tty/serial/serial-tegra.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/serial-tegra.c +0 -0
index 222032792d6c..cd481f7ba8eb 100644

drivers/tty/serial/serial-tegra.c static int tegra_uart_hw_init(struct tegra_uart_port *tup) · line 1049

Quoted 7 lines
drivers/tty/serial/serial-tegra.c +2 -2
@@ -1045,9 +1045,10 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
 
 	if (tup->cdata->fifo_mode_enable_status) {
 		ret = tegra_uart_wait_fifo_mode_enabled(tup);
-		dev_err(tup->uport.dev, "FIFO mode not enabled\n");
-		if (ret < 0)
+		if (ret < 0) {
+			dev_err(tup->uport.dev, "FIFO mode not enabled\n");

The error message seems a bit confusing. I read this as meaning "FIFO mode was expected to be enabled but wasn't" whereas this really seems to mean that for some reason the FIFO enable timed out.

In the former case it sounds like a some configuration mismatch, while it's really something that went wrong during the process of enabling the FIFO mode.

So I wonder if this should perhaps be something like:

	dev_err(tup->uport.dev, "FIFO mode enable timed out\n");

or something along those lines.

That said, this is a pre-existing problem and it's a bit pedantic, so in either case:

author maintainer
#2 lore raw
Quoted 33 lines · Thierry Reding
Quoted 16 lines · Jon Hunter

The Tegra serial driver always prints an error message when enabling the FIFO for devices that have support for checking the FIFO enable status. Fix this by only display the error message, when an error occurs.

Fixes 222dcdff3405 ("serial: tegra: check for FIFO mode enabled status")
---
 drivers/tty/serial/serial-tegra.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/serial-tegra.c +0 -0
index 222032792d6c..cd481f7ba8eb 100644

drivers/tty/serial/serial-tegra.c static int tegra_uart_hw_init(struct tegra_uart_port *tup) · line 1049

Quoted 7 lines
drivers/tty/serial/serial-tegra.c +2 -2
@@ -1045,9 +1045,10 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
 
 	if (tup->cdata->fifo_mode_enable_status) {
 		ret = tegra_uart_wait_fifo_mode_enabled(tup);
-		dev_err(tup->uport.dev, "FIFO mode not enabled\n");
-		if (ret < 0)
+		if (ret < 0) {
+			dev_err(tup->uport.dev, "FIFO mode not enabled\n");

The error message seems a bit confusing. I read this as meaning "FIFO mode was expected to be enabled but wasn't" whereas this really seems to mean that for some reason the FIFO enable timed out.

In the former case it sounds like a some configuration mismatch, while it's really something that went wrong during the process of enabling the FIFO mode.

Quoted 5 lines

So I wonder if this should perhaps be something like:

	dev_err(tup->uport.dev, "FIFO mode enable timed out\n");

or something along those lines.

Yes good point. Maybe I should just ...

	dev_err(tup->uport.dev,
		"Failed to enable FIFO mode: %d\n", ret);

Then if it is updated to ever return anything other that -ETIMEDOUT we are covered. I will send a V2.

Jon

Signature · 1 line
nvpublic