serial: tegra: Only print FIFO error message when an error occurs
Subsystems (4)
Jon Hunter
maintainerPATCH v2 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 displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the FIFO failed and display the error code.
---
Changes since V1:
- Updated the error message to make it more meaningful.
drivers/tty/serial/serial-tegra.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
drivers/tty/serial/serial-tegra.c +4 -2
@@ -1045,9 +1045,11 @@ 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, +"Failed to enable FIFO mode: %d\n" , ret);return ret; + } }else {/* * For all tegra devices (up to t210), there is a hardware
Signature · 1 line
2.25.1
Quoted 10 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 displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the FIFO failed and display the error code.
Fixes 222dcdff3405 ("serial: tegra: check for FIFO mode enabled status")Cc <[email protected]>Signed-off-by Jon Hunter <[email protected]>
Quoted 6 lines
---
Changes since V1:
- Updated the error message to make it more meaningful.
drivers/tty/serial/serial-tegra.c| 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)
Looks good:
Quoted 6 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 displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the FIFO failed and display the error code.
[...]
drivers/tty/serial/serial-tegra.c static int tegra_uart_hw_init(struct tegra_uart_port *tup) · line 1050
Quoted 9 lines
drivers/tty/serial/serial-tegra.c +3
-2@@ -1045,9 +1045,11 @@ 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, +"Failed to enable FIFO mode: %d\n" , ret);
Could you change this to use %pe and ERR_PTR(ret)?
Best Regards
Michał Mirosław
Jon Hunter
maintainerQuoted 10 lines · Michał Mirosław
Quoted 6 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 displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the FIFO failed and display the error code.
[...]
Quoted 2 lines
(quoted diff) +0
-0@@ -1045,9 +1045,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
Quoted 9 lines
drivers/tty/serial/serial-tegra.c static int tegra_uart_hw_init(struct tegra_uart_port *tup) · line 1050
Quoted 7 lines
drivers/tty/serial/serial-tegra.c +3
-2if (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, +"Failed to enable FIFO mode: %d\n" , ret);Could you change this to use %pe and
ERR_PTR(ret)?
Sorry, but it is not clear to me why this would be necessary in this case.
Jon
Signature · 1 line
nvpublic
Jon Hunter
maintainerQuoted 23 lines · Jon Hunter
Quoted 10 lines · Michał Mirosław
Quoted 6 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 displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the FIFO failed and display the error code.
[...]
Quoted 2 lines
(quoted diff) +0
-0@@ -1045,9 +1045,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)Quoted 9 lines
drivers/tty/serial/serial-tegra.c static int tegra_uart_hw_init(struct tegra_uart_port *tup) · line 1050
Quoted 7 lines
drivers/tty/serial/serial-tegra.c +3
-2if (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, +"Failed to enable FIFO mode: %d\n" , ret);Could you change this to use %pe and
ERR_PTR(ret)?
Quoted 1 line
Sorry, but it is not clear to me why this would be necessary in this case.
I see so '%pe' prints the symbolic name of the error code. While that is nice, it also looks a bit odd. Given that we simply print the error code values in this driver, from looking at other prints, I prefer to keep it as is for consistency.
Jon
Signature · 1 line
nvpublic
Quoted 25 lines · Jon Hunter
Quoted 23 lines · Jon Hunter
Quoted 19 lines · Michał Mirosław
Quoted 6 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 displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the FIFO failed and display the error code.
[...]
drivers/tty/serial/serial-tegra.c static int tegra_uart_hw_init(struct tegra_uart_port *tup) · line 1050
Quoted 9 lines
drivers/tty/serial/serial-tegra.c +3
-2@@ -1045,9 +1045,11 @@ 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, +"Failed to enable FIFO mode: %d\n" , ret);Could you change this to use %pe and
ERR_PTR(ret)?
Quoted 6 lines
Quoted 1 line
Sorry, but it is not clear to me why this would be necessary in this case.
I see so '%pe' prints the symbolic name of the error code. While that is nice, it also looks a bit odd. Given that we simply print the error code values in this driver, from looking at other prints, I prefer to keep it as is for consistency.
It is a quite new facility of printk(), so I woudn't expect it to be present in older code. It saves a bit of time when you occasionally hit an error, so even incremental conversion seems beneficial for me.
Best Regards
Michał Mirosław
09.07.2021 20:55, Michał Mirosław пишет:
Quoted 28 lines · Jon Hunter
Quoted 27 lines · Jon Hunter
Quoted 24 lines · Michał Mirosław
Quoted 10 lines · Jon Hunter
Quoted 6 lines
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 displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the FIFO failed and display the error code.
[...]
Quoted 2 lines
(quoted diff) +0
-0@@ -1045,9 +1045,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)Quoted 9 lines
drivers/tty/serial/serial-tegra.c static int tegra_uart_hw_init(struct tegra_uart_port *tup) · line 1050
Quoted 7 lines
drivers/tty/serial/serial-tegra.c +3
-2if (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, +"Failed to enable FIFO mode: %d\n" , ret);Could you change this to use %pe and
ERR_PTR(ret)?Sorry, but it is not clear to me why this would be necessary in this case.
Quoted 8 lines
Quoted 4 lines
I see so '%pe' prints the symbolic name of the error code. While that is nice, it also looks a bit odd. Given that we simply print the error code values in this driver, from looking at other prints, I prefer to keep it as is for consistency.
It is a quite new facility of
printk(), so I woudn't expect it to be present in older code. It saves a bit of time when you occasionally hit an error, so even incremental conversion seems beneficial for me.
It doesn't feel like a good approach to use ERR_PTR where it's not very appropriate. I suppose printk could get a new specifier, like '%de' for example, for the verbose integer error codes, couldn't it?