]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/whiteheat.c
tty: usb-serial krefs
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / whiteheat.c
index 2569b68b8334066926c3d26e1caee540d95dbbb4..11c8b97a5177ad6c645861a739cc0f62f30ab667 100644 (file)
@@ -646,7 +646,6 @@ static int whiteheat_open(struct tty_struct *tty,
                        struct usb_serial_port *port, struct file *filp)
 {
        int             retval = 0;
-       struct ktermios old_term;
 
        dbg("%s - port %d", __func__, port->number);
 
@@ -671,11 +670,8 @@ static int whiteheat_open(struct tty_struct *tty,
                goto exit;
        }
 
-       if (tty) {
-               old_term.c_cflag = ~tty->termios->c_cflag;
-               old_term.c_iflag = ~tty->termios->c_iflag;
-               whiteheat_set_termios(tty, port, &old_term);
-       }
+       if (tty)
+               firm_setup_port(tty);
 
        /* Work around HCD bugs */
        usb_clear_halt(port->serial->dev, port->read_urb->pipe);
@@ -926,7 +922,6 @@ static int whiteheat_ioctl(struct tty_struct *tty, struct file *file,
 static void whiteheat_set_termios(struct tty_struct *tty,
        struct usb_serial_port *port, struct ktermios *old_termios)
 {
-       /* FIXME */
        firm_setup_port(tty);
 }
 
@@ -1322,7 +1317,7 @@ static int firm_set_dtr(struct usb_serial_port *port, __u8 onoff)
 
        dtr_command.port = port->number - port->serial->minor + 1;
        dtr_command.state = onoff;
-       return firm_send_command(port, WHITEHEAT_SET_RTS,
+       return firm_send_command(port, WHITEHEAT_SET_DTR,
                        (__u8 *)&dtr_command, sizeof(dtr_command));
 }
 
@@ -1333,7 +1328,7 @@ static int firm_set_break(struct usb_serial_port *port, __u8 onoff)
 
        break_command.port = port->number - port->serial->minor + 1;
        break_command.state = onoff;
-       return firm_send_command(port, WHITEHEAT_SET_RTS,
+       return firm_send_command(port, WHITEHEAT_SET_BREAK,
                        (__u8 *)&break_command, sizeof(break_command));
 }
 
@@ -1486,7 +1481,7 @@ static void rx_data_softint(struct work_struct *work)
        struct whiteheat_private *info =
                container_of(work, struct whiteheat_private, rx_work);
        struct usb_serial_port *port = info->port;
-       struct tty_struct *tty = port->port.tty;
+       struct tty_struct *tty = tty_port_tty_get(&port->port);
        struct whiteheat_urb_wrap *wrap;
        struct urb *urb;
        unsigned long flags;
@@ -1498,7 +1493,7 @@ static void rx_data_softint(struct work_struct *work)
        spin_lock_irqsave(&info->lock, flags);
        if (info->flags & THROTTLED) {
                spin_unlock_irqrestore(&info->lock, flags);
-               return;
+               goto out;
        }
 
        list_for_each_safe(tmp, tmp2, &info->rx_urb_q) {
@@ -1518,7 +1513,7 @@ static void rx_data_softint(struct work_struct *work)
                                spin_unlock_irqrestore(&info->lock, flags);
                                tty_flip_buffer_push(tty);
                                schedule_work(&info->rx_work);
-                               return;
+                               goto out;
                        }
                        tty_insert_flip_string(tty, urb->transfer_buffer, len);
                        sent += len;
@@ -1541,6 +1536,8 @@ static void rx_data_softint(struct work_struct *work)
 
        if (sent)
                tty_flip_buffer_push(tty);
+out:
+       tty_kref_put(tty);
 }