Merge 3.10-rc6 into usb-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 19:02:38 +0000 (12:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 19:02:38 +0000 (12:02 -0700)
We want the fixes in this branch as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1  2 
drivers/usb/serial/f81232.c
drivers/usb/serial/pl2303.c

@@@ -165,11 -165,12 +165,12 @@@ static void f81232_set_termios(struct t
        /* FIXME - Stubbed out for now */
  
        /* Don't change anything if nothing has changed */
-       if (!tty_termios_hw_change(&tty->termios, old_termios))
+       if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
                return;
  
        /* Do the real work here... */
-       tty_termios_copy_hw(&tty->termios, old_termios);
+       if (old_termios)
+               tty_termios_copy_hw(&tty->termios, old_termios);
  }
  
  static int f81232_tiocmget(struct tty_struct *tty)
@@@ -187,12 -188,11 +188,11 @@@ static int f81232_tiocmset(struct tty_s
  
  static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
  {
-       struct ktermios tmp_termios;
        int result;
  
        /* Setup termios */
        if (tty)
-               f81232_set_termios(tty, port, &tmp_termios);
+               f81232_set_termios(tty, port, NULL);
  
        result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
        if (result) {
@@@ -288,14 -288,15 +288,14 @@@ static int f81232_ioctl(struct tty_stru
        struct serial_struct ser;
        struct usb_serial_port *port = tty->driver_data;
  
 -      dev_dbg(&port->dev, "%s (%d) cmd = 0x%04x\n", __func__,
 -              port->number, cmd);
 +      dev_dbg(&port->dev, "%s cmd = 0x%04x\n", __func__, cmd);
  
        switch (cmd) {
        case TIOCGSERIAL:
                memset(&ser, 0, sizeof ser);
                ser.type = PORT_16654;
                ser.line = port->serial->minor;
 -              ser.port = port->number;
 +              ser.port = port->port_number;
                ser.baud_base = 460800;
  
                if (copy_to_user((void __user *)arg, &ser, sizeof ser))
@@@ -275,7 -275,7 +275,7 @@@ static void pl2303_set_termios(struct t
        u8 control;
        const int baud_sup[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600,
                                 4800, 7200, 9600, 14400, 19200, 28800, 38400,
 -                               57600, 115200, 230400, 460800, 614400,
 +                               57600, 115200, 230400, 460800, 500000, 614400,
                                 921600, 1228800, 2457600, 3000000, 6000000 };
        int baud_floor, baud_ceil;
        int k;
           serial settings even to the same values as before. Thus
           we actually need to filter in this specific case */
  
-       if (!tty_termios_hw_change(&tty->termios, old_termios))
+       if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
                return;
  
        cflag = tty->termios.c_cflag;
        if (!buf) {
                dev_err(&port->dev, "%s - out of memory.\n", __func__);
                /* Report back no change occurred */
-               tty->termios = *old_termios;
+               if (old_termios)
+                       tty->termios = *old_termios;
                return;
        }
  
        i = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
                            GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE,
                            0, 0, buf, 7, 100);
 -      dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %x %x %x %x %x %x %x\n", i,
 -          buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
 +      dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);
  
        if (cflag & CSIZE) {
                switch (cflag & CSIZE) {
        control = priv->line_control;
        if ((cflag & CBAUD) == B0)
                priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
-       else if ((old_termios->c_cflag & CBAUD) == B0)
+       else if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
                priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
        if (control != priv->line_control) {
                control = priv->line_control;
        i = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
                            GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE,
                            0, 0, buf, 7, 100);
 -      dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %x %x %x %x %x %x %x\n", i,
 -           buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
 +      dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);
  
        if (cflag & CRTSCTS) {
                if (spriv->type == HX)
@@@ -490,7 -493,6 +491,6 @@@ static void pl2303_close(struct usb_ser
  
  static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
  {
-       struct ktermios tmp_termios;
        struct usb_serial *serial = port->serial;
        struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
        int result;
  
        /* Setup termios */
        if (tty)
-               pl2303_set_termios(tty, port, &tmp_termios);
+               pl2303_set_termios(tty, port, NULL);
  
        result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
        if (result) {
@@@ -640,7 -642,7 +640,7 @@@ static int pl2303_ioctl(struct tty_stru
                memset(&ser, 0, sizeof ser);
                ser.type = PORT_16654;
                ser.line = port->serial->minor;
 -              ser.port = port->number;
 +              ser.port = port->port_number;
                ser.baud_base = 460800;
  
                if (copy_to_user((void __user *)arg, &ser, sizeof ser))