All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs
@ 2021-06-30 12:56 Jon Hunter
  2021-06-30 17:25 ` Thierry Reding
  2021-07-08 22:25 ` Michał Mirosław
  0 siblings, 2 replies; 7+ messages in thread
From: Jon Hunter @ 2021-06-30 12:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Thierry Reding
  Cc: Laxman Dewangan, Krishna Yarlagadda, linux-serial, linux-tegra,
	Jon Hunter, stable

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: <stable@vger.kernel.org>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
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(-)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index 222032792d6c..eba5b9ecba34 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -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
-- 
2.25.1


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

* Re: [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs
  2021-06-30 12:56 [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs Jon Hunter
@ 2021-06-30 17:25 ` Thierry Reding
  2021-07-08 22:25 ` Michał Mirosław
  1 sibling, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2021-06-30 17:25 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Greg Kroah-Hartman, Jiri Slaby, Laxman Dewangan,
	Krishna Yarlagadda, linux-serial, linux-tegra, stable

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

On Wed, Jun 30, 2021 at 01:56:43PM +0100, Jon Hunter wrote:
> 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: <stable@vger.kernel.org>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> 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:

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs
  2021-06-30 12:56 [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs Jon Hunter
  2021-06-30 17:25 ` Thierry Reding
@ 2021-07-08 22:25 ` Michał Mirosław
  2021-07-09  8:34   ` Jon Hunter
  1 sibling, 1 reply; 7+ messages in thread
From: Michał Mirosław @ 2021-07-08 22:25 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Greg Kroah-Hartman, Jiri Slaby, Thierry Reding, Laxman Dewangan,
	Krishna Yarlagadda, linux-serial, linux-tegra, stable

On Wed, Jun 30, 2021 at 01:56:43PM +0100, Jon Hunter wrote:
> 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.
[...]
> @@ -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

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

* Re: [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs
  2021-07-08 22:25 ` Michał Mirosław
@ 2021-07-09  8:34   ` Jon Hunter
  2021-07-09 11:38     ` Jon Hunter
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Hunter @ 2021-07-09  8:34 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Greg Kroah-Hartman, Jiri Slaby, Thierry Reding, Laxman Dewangan,
	Krishna Yarlagadda, linux-serial, linux-tegra, stable



On 08/07/2021 23:25, Michał Mirosław wrote:
> On Wed, Jun 30, 2021 at 01:56:43PM +0100, Jon Hunter wrote:
>> 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.
> [...]
>> @@ -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)?

Sorry, but it is not clear to me why this would be necessary in this case.

Jon

-- 
nvpublic

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

* Re: [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs
  2021-07-09  8:34   ` Jon Hunter
@ 2021-07-09 11:38     ` Jon Hunter
  2021-07-09 17:55       ` Michał Mirosław
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Hunter @ 2021-07-09 11:38 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Greg Kroah-Hartman, Jiri Slaby, Thierry Reding, Laxman Dewangan,
	Krishna Yarlagadda, linux-serial, linux-tegra, stable


On 09/07/2021 09:34, Jon Hunter wrote:
> 
> 
> On 08/07/2021 23:25, Michał Mirosław wrote:
>> On Wed, Jun 30, 2021 at 01:56:43PM +0100, Jon Hunter wrote:
>>> 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.
>> [...]
>>> @@ -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)?
> 
> 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

-- 
nvpublic

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

* Re: [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs
  2021-07-09 11:38     ` Jon Hunter
@ 2021-07-09 17:55       ` Michał Mirosław
  2021-07-09 21:38         ` Dmitry Osipenko
  0 siblings, 1 reply; 7+ messages in thread
From: Michał Mirosław @ 2021-07-09 17:55 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Greg Kroah-Hartman, Jiri Slaby, Thierry Reding, Laxman Dewangan,
	Krishna Yarlagadda, linux-serial, linux-tegra, stable

On Fri, Jul 09, 2021 at 12:38:07PM +0100, Jon Hunter wrote:
> 
> On 09/07/2021 09:34, Jon Hunter wrote:
> > 
> > 
> > On 08/07/2021 23:25, Michał Mirosław wrote:
> >> On Wed, Jun 30, 2021 at 01:56:43PM +0100, Jon Hunter wrote:
> >>> 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.
> >> [...]
> >>> @@ -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)?
> > 
> > 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

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

* Re: [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs
  2021-07-09 17:55       ` Michał Mirosław
@ 2021-07-09 21:38         ` Dmitry Osipenko
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Osipenko @ 2021-07-09 21:38 UTC (permalink / raw)
  To: Michał Mirosław, Jon Hunter
  Cc: Greg Kroah-Hartman, Jiri Slaby, Thierry Reding, Laxman Dewangan,
	Krishna Yarlagadda, linux-serial, linux-tegra, stable

09.07.2021 20:55, Michał Mirosław пишет:
> On Fri, Jul 09, 2021 at 12:38:07PM +0100, Jon Hunter wrote:
>>
>> On 09/07/2021 09:34, Jon Hunter wrote:
>>>
>>>
>>> On 08/07/2021 23:25, Michał Mirosław wrote:
>>>> On Wed, Jun 30, 2021 at 01:56:43PM +0100, Jon Hunter wrote:
>>>>> 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.
>>>> [...]
>>>>> @@ -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)?
>>>
>>> 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.

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?

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

end of thread, other threads:[~2021-07-09 21:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 12:56 [PATCH V2] serial: tegra: Only print FIFO error message when an error occurs Jon Hunter
2021-06-30 17:25 ` Thierry Reding
2021-07-08 22:25 ` Michał Mirosław
2021-07-09  8:34   ` Jon Hunter
2021-07-09 11:38     ` Jon Hunter
2021-07-09 17:55       ` Michał Mirosław
2021-07-09 21:38         ` Dmitry Osipenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.