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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Peter Hung <hpeter+linux_kernel@xxxxxxxxx>
---
 drivers/usb/serial/f81232.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index 11a236b..79592d6 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -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;
 	}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux