linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: Fix an invalid comparing statement
@ 2019-05-27  5:01 Sugaya Taichi
  2019-06-10 11:31 ` Sugaya, Taichi
  2019-06-10 16:56 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Sugaya Taichi @ 2019-05-27  5:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Takao Orito, Kazuhiro Kasai, Shinji Kanematsu, Jassi Brar,
	Masami Hiramatsu, linux-kernel, linux-serial, Sugaya Taichi

Drop the if-statement which refers to 8th bit field of u8 variable.
The bit field is no longer used.

Fixes: ba44dc043004 ("serial: Add Milbeaut serial control")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sugaya Taichi <sugaya.taichi@socionext.com>
---
 drivers/tty/serial/milbeaut_usio.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
index 949ab7e..d7207ab 100644
--- a/drivers/tty/serial/milbeaut_usio.c
+++ b/drivers/tty/serial/milbeaut_usio.c
@@ -56,7 +56,6 @@
 #define MLB_USIO_SSR_FRE		BIT(4)
 #define MLB_USIO_SSR_PE			BIT(5)
 #define MLB_USIO_SSR_REC		BIT(7)
-#define MLB_USIO_SSR_BRK		BIT(8)
 #define MLB_USIO_FCR_FE1		BIT(0)
 #define MLB_USIO_FCR_FE2		BIT(1)
 #define MLB_USIO_FCR_FCL1		BIT(2)
@@ -180,18 +179,14 @@ static void mlb_usio_rx_chars(struct uart_port *port)
 		if (status & MLB_USIO_SSR_ORE)
 			port->icount.overrun++;
 		status &= port->read_status_mask;
-		if (status & MLB_USIO_SSR_BRK) {
-			flag = TTY_BREAK;
+		if (status & MLB_USIO_SSR_PE) {
+			flag = TTY_PARITY;
 			ch = 0;
 		} else
-			if (status & MLB_USIO_SSR_PE) {
-				flag = TTY_PARITY;
+			if (status & MLB_USIO_SSR_FRE) {
+				flag = TTY_FRAME;
 				ch = 0;
-			} else
-				if (status & MLB_USIO_SSR_FRE) {
-					flag = TTY_FRAME;
-					ch = 0;
-				}
+			}
 		if (flag)
 			uart_insert_char(port, status, MLB_USIO_SSR_ORE,
 					 ch, flag);
-- 
1.9.1


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

* Re: [PATCH] serial: Fix an invalid comparing statement
  2019-05-27  5:01 [PATCH] serial: Fix an invalid comparing statement Sugaya Taichi
@ 2019-06-10 11:31 ` Sugaya, Taichi
  2019-06-10 16:56 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Sugaya, Taichi @ 2019-06-10 11:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Colin Ian King
  Cc: Takao Orito, Kazuhiro Kasai, Shinji Kanematsu, Jassi Brar,
	Masami Hiramatsu, linux-kernel, linux-serial

Hi

Does anyone have comments?

On 2019/05/27 14:01, Sugaya Taichi wrote:
> Drop the if-statement which refers to 8th bit field of u8 variable.
> The bit field is no longer used.
> 
> Fixes: ba44dc043004 ("serial: Add Milbeaut serial control")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Sugaya Taichi <sugaya.taichi@socionext.com>
> ---
>   drivers/tty/serial/milbeaut_usio.c | 15 +++++----------
>   1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
> index 949ab7e..d7207ab 100644
> --- a/drivers/tty/serial/milbeaut_usio.c
> +++ b/drivers/tty/serial/milbeaut_usio.c
> @@ -56,7 +56,6 @@
>   #define MLB_USIO_SSR_FRE		BIT(4)
>   #define MLB_USIO_SSR_PE			BIT(5)
>   #define MLB_USIO_SSR_REC		BIT(7)
> -#define MLB_USIO_SSR_BRK		BIT(8)
>   #define MLB_USIO_FCR_FE1		BIT(0)
>   #define MLB_USIO_FCR_FE2		BIT(1)
>   #define MLB_USIO_FCR_FCL1		BIT(2)
> @@ -180,18 +179,14 @@ static void mlb_usio_rx_chars(struct uart_port *port)
>   		if (status & MLB_USIO_SSR_ORE)
>   			port->icount.overrun++;
>   		status &= port->read_status_mask;
> -		if (status & MLB_USIO_SSR_BRK) {
> -			flag = TTY_BREAK;
> +		if (status & MLB_USIO_SSR_PE) {
> +			flag = TTY_PARITY;
>   			ch = 0;
>   		} else
> -			if (status & MLB_USIO_SSR_PE) {
> -				flag = TTY_PARITY;
> +			if (status & MLB_USIO_SSR_FRE) {
> +				flag = TTY_FRAME;
>   				ch = 0;
> -			} else
> -				if (status & MLB_USIO_SSR_FRE) {
> -					flag = TTY_FRAME;
> -					ch = 0;
> -				}
> +			}
>   		if (flag)
>   			uart_insert_char(port, status, MLB_USIO_SSR_ORE,
>   					 ch, flag);
> 


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

* Re: [PATCH] serial: Fix an invalid comparing statement
  2019-05-27  5:01 [PATCH] serial: Fix an invalid comparing statement Sugaya Taichi
  2019-06-10 11:31 ` Sugaya, Taichi
@ 2019-06-10 16:56 ` Greg Kroah-Hartman
  2019-06-12  9:18   ` Sugaya, Taichi
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-10 16:56 UTC (permalink / raw)
  To: Sugaya Taichi
  Cc: Jiri Slaby, Takao Orito, Kazuhiro Kasai, Shinji Kanematsu,
	Jassi Brar, Masami Hiramatsu, linux-kernel, linux-serial

On Mon, May 27, 2019 at 02:01:27PM +0900, Sugaya Taichi wrote:
> Drop the if-statement which refers to 8th bit field of u8 variable.
> The bit field is no longer used.
> 
> Fixes: ba44dc043004 ("serial: Add Milbeaut serial control")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Sugaya Taichi <sugaya.taichi@socionext.com>
> ---
>  drivers/tty/serial/milbeaut_usio.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
> index 949ab7e..d7207ab 100644
> --- a/drivers/tty/serial/milbeaut_usio.c
> +++ b/drivers/tty/serial/milbeaut_usio.c
> @@ -56,7 +56,6 @@
>  #define MLB_USIO_SSR_FRE		BIT(4)
>  #define MLB_USIO_SSR_PE			BIT(5)
>  #define MLB_USIO_SSR_REC		BIT(7)
> -#define MLB_USIO_SSR_BRK		BIT(8)
>  #define MLB_USIO_FCR_FE1		BIT(0)
>  #define MLB_USIO_FCR_FE2		BIT(1)
>  #define MLB_USIO_FCR_FCL1		BIT(2)
> @@ -180,18 +179,14 @@ static void mlb_usio_rx_chars(struct uart_port *port)
>  		if (status & MLB_USIO_SSR_ORE)
>  			port->icount.overrun++;
>  		status &= port->read_status_mask;
> -		if (status & MLB_USIO_SSR_BRK) {
> -			flag = TTY_BREAK;
> +		if (status & MLB_USIO_SSR_PE) {
> +			flag = TTY_PARITY;
>  			ch = 0;
>  		} else
> -			if (status & MLB_USIO_SSR_PE) {
> -				flag = TTY_PARITY;
> +			if (status & MLB_USIO_SSR_FRE) {
> +				flag = TTY_FRAME;
>  				ch = 0;
> -			} else
> -				if (status & MLB_USIO_SSR_FRE) {
> -					flag = TTY_FRAME;
> -					ch = 0;
> -				}
> +			}
>  		if (flag)
>  			uart_insert_char(port, status, MLB_USIO_SSR_ORE,
>  					 ch, flag);

While the code never actually supported Break, you are explicitly
removing that logic now.  So shouldn't you instead _fix_ break handling?
The code before and after your change does not work any differently, so
this patch isn't really needed at this point.

thanks,

greg k-h

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

* Re: [PATCH] serial: Fix an invalid comparing statement
  2019-06-10 16:56 ` Greg Kroah-Hartman
@ 2019-06-12  9:18   ` Sugaya, Taichi
  0 siblings, 0 replies; 4+ messages in thread
From: Sugaya, Taichi @ 2019-06-12  9:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, Takao Orito, Kazuhiro Kasai, Shinji Kanematsu,
	Jassi Brar, Masami Hiramatsu, linux-kernel, linux-serial

Hi,

On 2019/06/11 1:56, Greg Kroah-Hartman wrote:
> On Mon, May 27, 2019 at 02:01:27PM +0900, Sugaya Taichi wrote:
>> Drop the if-statement which refers to 8th bit field of u8 variable.
>> The bit field is no longer used.
>>
>> Fixes: ba44dc043004 ("serial: Add Milbeaut serial control")
>> Reported-by: Colin Ian King <colin.king@canonical.com>
>> Signed-off-by: Sugaya Taichi <sugaya.taichi@socionext.com>
>> ---
>>   drivers/tty/serial/milbeaut_usio.c | 15 +++++----------
>>   1 file changed, 5 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
>> index 949ab7e..d7207ab 100644
>> --- a/drivers/tty/serial/milbeaut_usio.c
>> +++ b/drivers/tty/serial/milbeaut_usio.c
>> @@ -56,7 +56,6 @@
>>   #define MLB_USIO_SSR_FRE		BIT(4)
>>   #define MLB_USIO_SSR_PE			BIT(5)
>>   #define MLB_USIO_SSR_REC		BIT(7)
>> -#define MLB_USIO_SSR_BRK		BIT(8)
>>   #define MLB_USIO_FCR_FE1		BIT(0)
>>   #define MLB_USIO_FCR_FE2		BIT(1)
>>   #define MLB_USIO_FCR_FCL1		BIT(2)
>> @@ -180,18 +179,14 @@ static void mlb_usio_rx_chars(struct uart_port *port)
>>   		if (status & MLB_USIO_SSR_ORE)
>>   			port->icount.overrun++;
>>   		status &= port->read_status_mask;
>> -		if (status & MLB_USIO_SSR_BRK) {
>> -			flag = TTY_BREAK;
>> +		if (status & MLB_USIO_SSR_PE) {
>> +			flag = TTY_PARITY;
>>   			ch = 0;
>>   		} else
>> -			if (status & MLB_USIO_SSR_PE) {
>> -				flag = TTY_PARITY;
>> +			if (status & MLB_USIO_SSR_FRE) {
>> +				flag = TTY_FRAME;
>>   				ch = 0;
>> -			} else
>> -				if (status & MLB_USIO_SSR_FRE) {
>> -					flag = TTY_FRAME;
>> -					ch = 0;
>> -				}
>> +			}
>>   		if (flag)
>>   			uart_insert_char(port, status, MLB_USIO_SSR_ORE,
>>   					 ch, flag);
> 
> While the code never actually supported Break, you are explicitly
> removing that logic now.  So shouldn't you instead _fix_ break handling?
> The code before and after your change does not work any differently, so
> this patch isn't really needed at this point.
> 

According to research, MLB_USIO_SSR_BRK was a remnant of old HW.
Since current one does not handle the Break, all logic related it should be
removed. I try to make a new fix patch.

Thanks,
Sugaya Taichi

> thanks,
> 
> greg k-h
> 


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

end of thread, other threads:[~2019-06-12  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27  5:01 [PATCH] serial: Fix an invalid comparing statement Sugaya Taichi
2019-06-10 11:31 ` Sugaya, Taichi
2019-06-10 16:56 ` Greg Kroah-Hartman
2019-06-12  9:18   ` Sugaya, Taichi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).