Re: [PATCHv2] USB-serial: ftdi_sio: add space/mark parity

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

 



Hi,

> Style wish it might be better to split up the layers of ?: use into
> something easier to follow. Otherwise looks fine. Would need a
> Signed-off-by to get merged.
> 
> (See Documentation/SubmittingPatches.txt)
thanks for your comments. Here's the reworked patch
(should work for both 2.6.31 and 2.6.32-rc3):

==
From: Roland Koebler <r.koebler@xxxxxxxx>

Add mark and space parity, since the device supports it.

Signed-off-by: Roland Koebler <r.koebler@xxxxxxxx>
---

--- linux-2.6.31/drivers/usb/serial/ftdi_sio.c.orig	2009-10-05 18:38:13.000000000 +0200
+++ linux-2.6.31/drivers/usb/serial/ftdi_sio.c	2009-10-05 19:52:10.000000000 +0200
@@ -2353,15 +2353,21 @@ static void ftdi_set_termios(struct tty_
 
 	/* Set number of data bits, parity, stop bits */
 
-	termios->c_cflag &= ~CMSPAR;
-
 	urb_value = 0;
 	urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 :
 		      FTDI_SIO_SET_DATA_STOP_BITS_1);
-	urb_value |= (cflag & PARENB ?
-		      (cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_ODD :
-		       FTDI_SIO_SET_DATA_PARITY_EVEN) :
-		      FTDI_SIO_SET_DATA_PARITY_NONE);
+	if (cflag & PARENB) {
+		if (cflag & CMSPAR)
+			urb_value |= cflag & PARODD ?
+				     FTDI_SIO_SET_DATA_PARITY_MARK :
+				     FTDI_SIO_SET_DATA_PARITY_SPACE;
+		else
+			urb_value |= cflag & PARODD ?
+				     FTDI_SIO_SET_DATA_PARITY_ODD :
+				     FTDI_SIO_SET_DATA_PARITY_EVEN;
+	} else {
+		urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE;
+	}
 	if (cflag & CSIZE) {
 		switch (cflag & CSIZE) {
 		case CS5: urb_value |= 5; dbg("Setting CS5"); break;
--
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