diff options
Diffstat (limited to 'drivers/usb/serial/mos7720.c')
-rw-r--r-- | drivers/usb/serial/mos7720.c | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index e02c198016b0..40f3a0188807 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -564,22 +564,25 @@ static void mos7720_close(struct usb_serial_port *port, struct file *filp) | |||
564 | } | 564 | } |
565 | 565 | ||
566 | /* While closing port, shutdown all bulk read, write * | 566 | /* While closing port, shutdown all bulk read, write * |
567 | * and interrupt read if they exists */ | 567 | * and interrupt read if they exists, otherwise nop */ |
568 | if (serial->dev) { | 568 | dbg("Shutdown bulk write"); |
569 | dbg("Shutdown bulk write"); | 569 | usb_kill_urb(port->write_urb); |
570 | usb_kill_urb(port->write_urb); | 570 | dbg("Shutdown bulk read"); |
571 | dbg("Shutdown bulk read"); | 571 | usb_kill_urb(port->read_urb); |
572 | usb_kill_urb(port->read_urb); | 572 | |
573 | mutex_lock(&serial->disc_mutex); | ||
574 | /* these commands must not be issued if the device has | ||
575 | * been disconnected */ | ||
576 | if (!serial->disconnected) { | ||
577 | data = 0x00; | ||
578 | send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor, | ||
579 | 0x04, &data); | ||
580 | |||
581 | data = 0x00; | ||
582 | send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor, | ||
583 | 0x01, &data); | ||
573 | } | 584 | } |
574 | 585 | mutex_unlock(&serial->disc_mutex); | |
575 | data = 0x00; | ||
576 | send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor, | ||
577 | 0x04, &data); | ||
578 | |||
579 | data = 0x00; | ||
580 | send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor, | ||
581 | 0x01, &data); | ||
582 | |||
583 | mos7720_port->open = 0; | 586 | mos7720_port->open = 0; |
584 | 587 | ||
585 | dbg("Leaving %s", __FUNCTION__); | 588 | dbg("Leaving %s", __FUNCTION__); |
@@ -1040,11 +1043,6 @@ static void change_port_settings(struct moschip_port *mos7720_port, | |||
1040 | 1043 | ||
1041 | tty = mos7720_port->port->tty; | 1044 | tty = mos7720_port->port->tty; |
1042 | 1045 | ||
1043 | if ((!tty) || (!tty->termios)) { | ||
1044 | dbg("%s - no tty structures", __FUNCTION__); | ||
1045 | return; | ||
1046 | } | ||
1047 | |||
1048 | dbg("%s: Entering ..........", __FUNCTION__); | 1046 | dbg("%s: Entering ..........", __FUNCTION__); |
1049 | 1047 | ||
1050 | lData = UART_LCR_WLEN8; | 1048 | lData = UART_LCR_WLEN8; |
@@ -1175,7 +1173,10 @@ static void change_port_settings(struct moschip_port *mos7720_port, | |||
1175 | 1173 | ||
1176 | dbg("%s - baud rate = %d", __FUNCTION__, baud); | 1174 | dbg("%s - baud rate = %d", __FUNCTION__, baud); |
1177 | status = send_cmd_write_baud_rate(mos7720_port, baud); | 1175 | status = send_cmd_write_baud_rate(mos7720_port, baud); |
1178 | 1176 | /* FIXME: needs to write actual resulting baud back not just | |
1177 | blindly do so */ | ||
1178 | if (cflag & CBAUD) | ||
1179 | tty_encode_baud_rate(tty, baud, baud); | ||
1179 | /* Enable Interrupts */ | 1180 | /* Enable Interrupts */ |
1180 | data = 0x0c; | 1181 | data = 0x0c; |
1181 | send_mos_cmd(serial, MOS_WRITE, port_number, UART_IER, &data); | 1182 | send_mos_cmd(serial, MOS_WRITE, port_number, UART_IER, &data); |
@@ -1214,10 +1215,6 @@ static void mos7720_set_termios(struct usb_serial_port *port, | |||
1214 | 1215 | ||
1215 | tty = port->tty; | 1216 | tty = port->tty; |
1216 | 1217 | ||
1217 | if (!port->tty || !port->tty->termios) { | ||
1218 | dbg("%s - no tty or termios", __FUNCTION__); | ||
1219 | return; | ||
1220 | } | ||
1221 | 1218 | ||
1222 | if (!mos7720_port->open) { | 1219 | if (!mos7720_port->open) { |
1223 | dbg("%s - port not opened", __FUNCTION__); | 1220 | dbg("%s - port not opened", __FUNCTION__); |
@@ -1228,19 +1225,13 @@ static void mos7720_set_termios(struct usb_serial_port *port, | |||
1228 | 1225 | ||
1229 | cflag = tty->termios->c_cflag; | 1226 | cflag = tty->termios->c_cflag; |
1230 | 1227 | ||
1231 | if (!cflag) { | 1228 | dbg("%s - cflag %08x iflag %08x", __FUNCTION__, |
1232 | printk("%s %s\n",__FUNCTION__,"cflag is NULL"); | ||
1233 | return; | ||
1234 | } | ||
1235 | |||
1236 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, | ||
1237 | tty->termios->c_cflag, | 1229 | tty->termios->c_cflag, |
1238 | RELEVANT_IFLAG(tty->termios->c_iflag)); | 1230 | RELEVANT_IFLAG(tty->termios->c_iflag)); |
1239 | 1231 | ||
1240 | if (old_termios) | 1232 | dbg("%s - old cflag %08x old iflag %08x", __FUNCTION__, |
1241 | dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, | 1233 | old_termios->c_cflag, |
1242 | old_termios->c_cflag, | 1234 | RELEVANT_IFLAG(old_termios->c_iflag)); |
1243 | RELEVANT_IFLAG(old_termios->c_iflag)); | ||
1244 | 1235 | ||
1245 | dbg("%s - port %d", __FUNCTION__, port->number); | 1236 | dbg("%s - port %d", __FUNCTION__, port->number); |
1246 | 1237 | ||