Skip to contentSkip to conversation

usb: serial: implement CMSPAR for F81232

PATCH In review Peter Hung 2 participants 4 messages Jan 28, 2015 – Jan 29, 2015

Subsystems (2)
lore
Share & tools
lore

Peter Hung

author
#0 lore raw

PATCH v3 5/5 usb: serial: implement CMSPAR for F81232

This patch implement CMSPAR in set_termios,
and fix some warnning from checkpatch.pl

---
 drivers/usb/serial/f81232.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/usb/serial/f81232.c +15 -6
index 11a236b..79592d6 100644
@@ -175,7 +175,7 @@ static void f81232_read_msr(struct f81232_private *priv)
 
 
 static inline int update_mctrl(struct f81232_private *port_priv,
-					   unsigned int set, unsigned int clear)
+		unsigned int set, unsigned int clear)
 {
 	struct usb_device *dev = port_priv->port->serial->dev;
 	u8 urb_value;
@@ -361,12 +361,21 @@ static void f81232_set_termios(struct tty_struct *tty,
 
 
 	if (cflag & PARENB) {
-		if (cflag & PARODD)
-			new_lcr |= UART_LCR_PARITY; /* odd */
-		else
-			new_lcr |= SERIAL_EVEN_PARITY; /* even */
+		if (cflag & CMSPAR) {
+			if (cflag & PARODD)
+				new_lcr |= (UART_LCR_PARITY | UART_LCR_SPAR);
+			else
+				new_lcr |= (SERIAL_EVEN_PARITY
+							| UART_LCR_SPAR);
+		} else {
+			if (cflag & PARODD)
+				new_lcr |= UART_LCR_PARITY; /* odd */
+			else
+				new_lcr |= SERIAL_EVEN_PARITY; /* even */
+		}
 	}
 
+
 	if (cflag & CSTOPB)
 		new_lcr |= UART_LCR_STOP;
 	else
@@ -445,7 +454,7 @@ static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
 
 	result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
 	if (result) {
-		dev_err(&port->dev, "failed submitting interrupt urb, error %d\n",
+		dev_err(&port->dev, "failed submitting urb, error %d\n",
 			result);
 		return result;
 	}
Signature · 1 line
1.9.1
#1 lore raw

Hello.

Quoted 2 lines · Peter Hung

This patch implement CMSPAR in set_termios,
and fix some warnning from checkpatch.pl

Please don't try to do 2 unrelated things in one patch.

Quoted 9 lines
---
  drivers/usb/serial/f81232.c | 21 +++++++++++++++------
  1 file changed, 15 insertions(+), 6 deletions(-)
drivers/usb/serial/f81232.c +0 -0
index 11a236b..79592d6 100644

[...]

Quoted 13 lines
drivers/usb/serial/f81232.c +5 -4
@@ -361,12 +361,21 @@ static void f81232_set_termios(struct tty_struct *tty,
 
 
  	if (cflag & PARENB) {
-		if (cflag & PARODD)
-			new_lcr |= UART_LCR_PARITY; /* odd */
-		else
-			new_lcr |= SERIAL_EVEN_PARITY; /* even */
+		if (cflag & CMSPAR) {
+			if (cflag & PARODD)
+				new_lcr |= (UART_LCR_PARITY | UART_LCR_SPAR);
+			else
+				new_lcr |= (SERIAL_EVEN_PARITY

drivers/usb/serial/f81232.c static void f81232_set_termios(struct tty_struct *tty, · line 378

Quoted 10 lines
drivers/usb/serial/f81232.c +8 -0
+							| UART_LCR_SPAR);
+		} else {
+			if (cflag & PARODD)
+				new_lcr |= UART_LCR_PARITY; /* odd */
+			else
+				new_lcr |= SERIAL_EVEN_PARITY; /* even */
+		}
  	}
 
+

Not needed at all.

drivers/usb/serial/f81232.c static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) · line 457

Quoted 9 lines
drivers/usb/serial/f81232.c +1 -1
  	if (cflag & CSTOPB)
  		new_lcr |= UART_LCR_STOP;
  	else
@@ -445,7 +454,7 @@ static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
 
  	result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
  	if (result) {
-		dev_err(&port->dev, "failed submitting interrupt urb, error %d\n",
+		dev_err(&port->dev, "failed submitting urb, error %d\n",

What are you fixing here?

WBR, Sergei

author
#2 lore raw

Hello.

I had using "scripts/checkpatch.pl -f" to scan original f81232.c.
It reported with "quoted string split across lines", so I merge these
2 strings into 1 in patch 1/5. But it still warning with "line over 80 character", so I had shorted string with this line.

I will refine my patch set again with more attention. Thanks for your advice.

Sergei Shtylyov 於 2015/1/28 下午 08:31 寫道:

Quoted 62 lines

Hello.

Quoted 2 lines · Peter Hung

This patch implement CMSPAR in set_termios,
and fix some warnning from checkpatch.pl

Please don't try to do 2 unrelated things in one patch.

Quoted 9 lines
---
  drivers/usb/serial/f81232.c | 21 +++++++++++++++------
  1 file changed, 15 insertions(+), 6 deletions(-)
drivers/usb/serial/f81232.c +0 -0
index 11a236b..79592d6 100644

[...]

Quoted 14 lines
drivers/usb/serial/f81232.c +5 -4
@@ -361,12 +361,21 @@ static void f81232_set_termios(struct tty_struct
 *tty,
 
 
      if (cflag & PARENB) {
-        if (cflag & PARODD)
-            new_lcr |= UART_LCR_PARITY; /* odd */
-        else
-            new_lcr |= SERIAL_EVEN_PARITY; /* even */
+        if (cflag & CMSPAR) {
+            if (cflag & PARODD)
+                new_lcr |= (UART_LCR_PARITY | UART_LCR_SPAR);
+            else
+                new_lcr |= (SERIAL_EVEN_PARITY

drivers/usb/serial/f81232.c static void f81232_set_termios(struct tty_struct · line 379

Quoted 10 lines
drivers/usb/serial/f81232.c +8 -0
+                            | UART_LCR_SPAR);
+        } else {
+            if (cflag & PARODD)
+                new_lcr |= UART_LCR_PARITY; /* odd */
+            else
+                new_lcr |= SERIAL_EVEN_PARITY; /* even */
+        }
      }
 
+

Not needed at all.

drivers/usb/serial/f81232.c static int f81232_open(struct tty_struct *tty, · line 459

Quoted 11 lines
drivers/usb/serial/f81232.c +0 -0
      if (cflag & CSTOPB)
          new_lcr |= UART_LCR_STOP;

else

drivers/usb/serial/f81232.c +1 -1
@@ -445,7 +454,7 @@ static int f81232_open(struct tty_struct *tty,
 struct usb_serial_port *port)
 
      result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
      if (result) {
-        dev_err(&port->dev, "failed submitting interrupt urb, error
 %d\n",
+        dev_err(&port->dev, "failed submitting urb, error %d\n",

What are you fixing here?

WBR, Sergei

Signature · 2 lines
With Best Regards,
Peter Hung
#3 lore raw

Hello.

Quoted 1 line · Peter Hung

Hello.

Please don't top-post.

Quoted 3 lines

I had using "scripts/checkpatch.pl -f" to scan original f81232.c. It reported with "quoted string split across lines", so I merge these 2 strings into 1 in patch 1/5.

Seems like another unrelated change...

Quoted 2 lines

But it still warning with "line over 80 character", so I had shorted string with this line.

Hm, the modern checkpatch.pl shouldn't warn about long lines due to string
literals used in dev_err(), etc. calls.

Quoted 1 line

I will refine my patch set again with more attention.

In any case, don't leave the warnings till some next patch, fix them at once.

Quoted 1 line

Thanks for your advice.

WBR, Sergei