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 the port has just hung up or is in another error state */ 222 if ((filp->f_flags & O_NONBLOCK) || 223 (tty->flags & (1 << TTY_IO_ERROR))) { 224 port->flags |= ASYNC_NORMAL_ACTIVE; 225 return 0; 226 }
··· 221 the port has just hung up or is in another error state */ 222 if ((filp->f_flags & O_NONBLOCK) || 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); 227 port->flags |= ASYNC_NORMAL_ACTIVE; 228 return 0; 229 }
+21
drivers/usb/serial/cp210x.c
··· 50 static void cp210x_break_ctl(struct tty_struct *, int); 51 static int cp210x_startup(struct usb_serial *); 52 static void cp210x_disconnect(struct usb_serial *); 53 54 static int debug; 55 ··· 145 .tiocmset = cp210x_tiocmset, 146 .attach = cp210x_startup, 147 .disconnect = cp210x_disconnect, 148 }; 149 150 /* Config request types */ ··· 750 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); 751 } 752 753 static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) 754 { 755 struct usb_serial_port *port = tty->driver_data; ··· 778 dbg("%s - control = 0x%.2x", __func__, control); 779 780 return result; 781 } 782 783 static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
··· 50 static void cp210x_break_ctl(struct tty_struct *, int); 51 static int cp210x_startup(struct usb_serial *); 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); 55 56 static int debug; 57 ··· 143 .tiocmset = cp210x_tiocmset, 144 .attach = cp210x_startup, 145 .disconnect = cp210x_disconnect, 146 + .dtr_rts = cp210x_dtr_rts, 147 + .carrier_raised = cp210x_carrier_raised 148 }; 149 150 /* Config request types */ ··· 746 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); 747 } 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 + 757 static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) 758 { 759 struct usb_serial_port *port = tty->driver_data; ··· 766 dbg("%s - control = 0x%.2x", __func__, control); 767 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; 778 } 779 780 static void cp210x_break_ctl (struct tty_struct *tty, int break_state)