Merge branches 'release', 'asus', 'sony-laptop' and 'thinkpad' into release
[pandora-kernel.git] / drivers / usb / serial / io_edgeport.c
index dd42f57..3428ccc 100644 (file)
@@ -959,7 +959,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
  *
  *     This function will block the close until one of the following:
  *             1. Response to our Chase comes from Edgeport
- *             2. A timout of 10 seconds without activity has expired
+ *             2. A timeout of 10 seconds without activity has expired
  *                (1K of Edgeport data @ 2400 baud ==> 4 sec to empty)
  *
  ************************************************************************/
@@ -999,7 +999,7 @@ static void block_until_chase_response(struct edgeport_port *edge_port)
                                return;
                        }
                } else {
-                       // Reset timout value back to 10 seconds
+                       // Reset timeout value back to 10 seconds
                        dbg("%s - Last %d, Current %d", __FUNCTION__, lastCredits, edge_port->txCredits);
                        loop = 10;
                }
@@ -1014,7 +1014,7 @@ static void block_until_chase_response(struct edgeport_port *edge_port)
  *     This function will block the close until one of the following:
  *             1. TX count are 0
  *             2. The edgeport has stopped
- *             3. A timout of 3 seconds without activity has expired
+ *             3. A timeout of 3 seconds without activity has expired
  *
  ************************************************************************/
 static void block_until_tx_empty (struct edgeport_port *edge_port)
@@ -1050,7 +1050,7 @@ static void block_until_tx_empty (struct edgeport_port *edge_port)
                                return;
                        }
                } else {
-                       // Reset timout value back to seconds
+                       // Reset timeout value back to seconds
                        loop = 30;
                }
        }
@@ -1503,22 +1503,16 @@ static void edge_unthrottle (struct usb_serial_port *port)
  *****************************************************************************/
 static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
 {
+       /* FIXME: This function appears unused ?? */
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        struct tty_struct *tty = port->tty;
        unsigned int cflag;
 
-       if (!port->tty || !port->tty->termios) {
-               dbg ("%s - no tty or termios", __FUNCTION__);
-               return;
-       }
-
        cflag = tty->termios->c_cflag;
        dbg("%s - clfag %08x iflag %08x", __FUNCTION__, 
            tty->termios->c_cflag, tty->termios->c_iflag);
-       if (old_termios) {
-               dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__,
-                   old_termios->c_cflag, old_termios->c_iflag);
-       }
+       dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__,
+           old_termios->c_cflag, old_termios->c_iflag);
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -2366,9 +2360,8 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa
        int status;
        unsigned char number = edge_port->port->number - edge_port->port->serial->minor;
 
-       if ((!edge_serial->is_epic) ||
-           ((edge_serial->is_epic) &&
-            (!edge_serial->epic_descriptor.Supports.IOSPSetBaudRate))) {
+       if (edge_serial->is_epic &&
+           !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) {
                dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d",
                    edge_port->port->number, baudRate);
                return 0;
@@ -2461,18 +2454,16 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r
 
        dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue);
 
-       if ((!edge_serial->is_epic) ||
-           ((edge_serial->is_epic) &&
-            (!edge_serial->epic_descriptor.Supports.IOSPWriteMCR) &&
-            (regNum == MCR))) {
+       if (edge_serial->is_epic &&
+           !edge_serial->epic_descriptor.Supports.IOSPWriteMCR &&
+           regNum == MCR) {
                dbg("SendCmdWriteUartReg - Not writing to MCR Register");
                return 0;
        }
 
-       if ((!edge_serial->is_epic) ||
-           ((edge_serial->is_epic) &&
-            (!edge_serial->epic_descriptor.Supports.IOSPWriteLCR) &&
-            (regNum == LCR))) {
+       if (edge_serial->is_epic &&
+           !edge_serial->epic_descriptor.Supports.IOSPWriteLCR &&
+           regNum == LCR) {
                dbg ("SendCmdWriteUartReg - Not writing to LCR Register");
                return 0;
        }
@@ -2656,7 +2647,11 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi
 
        dbg("%s - baud rate = %d", __FUNCTION__, baud);
        status = send_cmd_write_baud_rate (edge_port, baud);
-
+       if (status == -1) {
+               /* Speed change was not possible - put back the old speed */
+               baud = tty_termios_baud_rate(old_termios);
+               tty_encode_baud_rate(tty, baud, baud);
+       }
        return;
 }
 
@@ -2885,7 +2880,7 @@ static int edge_startup (struct usb_serial *serial)
            (edge_serial->product_info.NumPorts != serial->num_ports)) {
                dev_warn(&serial->dev->dev, "Device Reported %d serial ports "
                         "vs. core thinking we have %d ports, email "
-                        "greg@kroah.com this information.",
+                        "greg@kroah.com this information.\n",
                         edge_serial->product_info.NumPorts,
                         serial->num_ports);
        }