[PATCH] mct_u232: Convert to proper speed handling API

Alan Cox <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Red Hat UK Cyf., Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, Y Deyrnas Gyfunol. Cofrestrwyd yng Nghymru a Lloegr o'r rhif cofrestru 3798903
Message-ID <[email protected]>
Signed-off-by: Alan Cox <[email protected]>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.23rc1-mm1/drivers/usb/serial/mct_u232.c linux-2.6.23rc1-mm1/drivers/usb/serial/mct_u232.c
--- linux.vanilla-2.6.23rc1-mm1/drivers/usb/serial/mct_u232.c	2007-07-26 15:01:52.000000000 +0100
+++ linux-2.6.23rc1-mm1/drivers/usb/serial/mct_u232.c	2007-07-26 15:31:17.000000000 +0100
@@ -184,21 +184,21 @@
  * we do not know how to support. We ignore them for the moment.
  * XXX Rate-limit the error message, it's user triggerable.
  */
-static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value)
+static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value)
 {
 	if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID
 	  || le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) {
 		switch (value) {
-		case    B300: return 0x01;
-		case    B600: return 0x02; /* this one not tested */
-		case   B1200: return 0x03;
-		case   B2400: return 0x04;
-		case   B4800: return 0x06;
-		case   B9600: return 0x08;
-		case  B19200: return 0x09;
-		case  B38400: return 0x0a;
-		case  B57600: return 0x0b;
-		case B115200: return 0x0c;
+		case    300: return 0x01;
+		case    600: return 0x02; /* this one not tested */
+		case   1200: return 0x03;
+		case   2400: return 0x04;
+		case   4800: return 0x06;
+		case   9600: return 0x08;
+		case  19200: return 0x09;
+		case  38400: return 0x0a;
+		case  57600: return 0x0b;
+		case 115200: return 0x0c;
 		default:
 			err("MCT USB-RS232: unsupported baudrate request 0x%x,"
 			    " using default of B9600", value);
@@ -206,27 +206,27 @@
 		}
 	} else {
 		switch (value) {
-		case    B300: value =     300; break;
-		case    B600: value =     600; break;
-		case   B1200: value =    1200; break;
-		case   B2400: value =    2400; break;
-		case   B4800: value =    4800; break;
-		case   B9600: value =    9600; break;
-		case  B19200: value =   19200; break;
-		case  B38400: value =   38400; break;
-		case  B57600: value =   57600; break;
-		case B115200: value =  115200; break;
-		default:
-			err("MCT USB-RS232: unsupported baudrate request 0x%x,"
-			    " using default of B9600", value);
-			value = 9600;
+			case 300: break;
+			case 600: break;
+			case 1200: break;
+			case 2400: break;
+			case 4800: break;
+			case 9600: break;
+			case 19200: break;
+			case 38400: break;
+			case 57600: break;
+			case 115200: break;
+			default:
+				err("MCT USB-RS232: unsupported baudrate request 0x%x,"
+				    " using default of B9600", value);
+				value = 9600;
 		}
 		return 115200/value;
 	}
 }
 
 static int mct_u232_set_baud_rate(struct usb_serial *serial, struct usb_serial_port *port,
-				  int value)
+				  speed_t value)
 {
 	__le32 divisor;
         int rc;
@@ -634,7 +634,7 @@
 		mct_u232_set_modem_ctrl(serial, control_state);
 	}
 
-	mct_u232_set_baud_rate(serial, port, cflag & CBAUD);
+	mct_u232_set_baud_rate(serial, port, tty_get_baud_rate(port->tty));
 
 	if ((cflag & CBAUD) == B0 ) {
 		dbg("%s: baud is B0", __FUNCTION__);
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.23rc1-mm1/drivers/usb/serial/mct_u232.h linux-2.6.23rc1-mm1/drivers/usb/serial/mct_u232.h
--- linux.vanilla-2.6.23rc1-mm1/drivers/usb/serial/mct_u232.h	2007-07-26 15:01:52.000000000 +0100
+++ linux-2.6.23rc1-mm1/drivers/usb/serial/mct_u232.h	2007-07-26 15:31:24.000000000 +0100
@@ -79,7 +79,7 @@
  * and "Intel solution". They are the regular MCT and "Sitecom" for us.
  * This is pointless to document in the header, see the code for the bits.
  */
-static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value);
+static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value);
 
 /*
  * Line Control Register (LCR)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.