vserver 1.9.3
[linux-2.6.git] / drivers / usb / serial / digi_acceleport.c
index f187b31..3ac69f2 100644 (file)
@@ -624,14 +624,7 @@ static void digi_wakeup_write( struct usb_serial_port *port )
        wake_up_interruptible( &port->write_wait );
 
        /* wake up line discipline */
-       if( (tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
-       && tty->ldisc.write_wakeup )
-               (tty->ldisc.write_wakeup)(tty);
-
-       /* wake up other tty processes */
-       wake_up_interruptible( &tty->write_wait );
-       /* For 2.2.16 backport -- wake_up_interruptible( &tty->poll_wait ); */
-
+       tty_wakeup(tty);
 }
 
 
@@ -1553,13 +1546,17 @@ static void digi_close( struct usb_serial_port *port, struct file *filp )
 dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_count );
 
 
+       /* if disconnected, just clear flags */
+       if (!usb_get_intfdata(port->serial->interface))
+               goto exit;
+
        /* do cleanup only after final close on this port */
        spin_lock_irqsave( &priv->dp_port_lock, flags );
        priv->dp_in_close = 1;
        spin_unlock_irqrestore( &priv->dp_port_lock, flags );
 
        /* tell line discipline to process only XON/XOFF */
-        tty->closing = 1;
+       tty->closing = 1;
 
        /* wait for output to drain */
        if( (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) {
@@ -1569,8 +1566,7 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
        /* flush driver and line discipline buffers */
        if( tty->driver->flush_buffer )
                tty->driver->flush_buffer( tty );
-       if( tty->ldisc.flush_buffer )
-               tty->ldisc.flush_buffer( tty );
+       tty_ldisc_flush(tty);
 
        if (port->serial->dev) {
                /* wait for transmit idle */
@@ -1624,6 +1620,7 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
 
        tty->closing = 0;
 
+exit:
        spin_lock_irqsave( &priv->dp_port_lock, flags );
        priv->dp_write_urb_in_use = 0;
        priv->dp_in_close = 0;