Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
tty: cp210x: Fix carrier handling
tty_port: If we are opened non blocking we still need to raise the carrier

+24
+3
drivers/char/tty_port.c
··· 221 221 the port has just hung up or is in another error state */ 222 222 if ((filp->f_flags & O_NONBLOCK) || 223 223 (tty->flags & (1 << TTY_IO_ERROR))) { 224 + /* Indicate we are open */ 225 + if (tty->termios->c_cflag & CBAUD) 226 + tty_port_raise_dtr_rts(port); 224 227 port->flags |= ASYNC_NORMAL_ACTIVE; 225 228 return 0; 226 229 }
+21
drivers/usb/serial/cp210x.c
··· 50 50 static void cp210x_break_ctl(struct tty_struct *, int); 51 51 static int cp210x_startup(struct usb_serial *); 52 52 static void cp210x_disconnect(struct usb_serial *); 53 + static void cp210x_dtr_rts(struct usb_serial_port *p, int on); 54 + static int cp210x_carrier_raised(struct usb_serial_port *p); 53 55 54 56 static int debug; 55 57 ··· 145 143 .tiocmset = cp210x_tiocmset, 146 144 .attach = cp210x_startup, 147 145 .disconnect = cp210x_disconnect, 146 + .dtr_rts = cp210x_dtr_rts, 147 + .carrier_raised = cp210x_carrier_raised 148 148 }; 149 149 150 150 /* Config request types */ ··· 750 746 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); 751 747 } 752 748 749 + static void cp210x_dtr_rts(struct usb_serial_port *p, int on) 750 + { 751 + if (on) 752 + cp210x_tiocmset_port(p, NULL, TIOCM_DTR|TIOCM_RTS, 0); 753 + else 754 + cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS); 755 + } 756 + 753 757 static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) 754 758 { 755 759 struct usb_serial_port *port = tty->driver_data; ··· 778 766 dbg("%s - control = 0x%.2x", __func__, control); 779 767 780 768 return result; 769 + } 770 + 771 + static int cp210x_carrier_raised(struct usb_serial_port *p) 772 + { 773 + unsigned int control; 774 + cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); 775 + if (control & CONTROL_DCD) 776 + return 1; 777 + return 0; 781 778 } 782 779 783 780 static void cp210x_break_ctl (struct tty_struct *tty, int break_state)