vserver 2.0 rc7
[linux-2.6.git] / drivers / usb / serial / digi_acceleport.c
index 4b59d75..a19a47f 100644 (file)
 #include <linux/workqueue.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
+#include <linux/wait.h>
 #include "usb-serial.h"
 
 /* Defines */
@@ -567,30 +568,23 @@ static struct usb_serial_device_type digi_acceleport_4_device = {
 *  and the sleep.  In other words, spin_unlock_irqrestore and
 *  interruptible_sleep_on_timeout are "atomic" with respect to
 *  wake ups.  This is used to implement condition variables.
+*
+*  interruptible_sleep_on_timeout is deprecated and has been replaced
+*  with the equivalent code.
 */
 
 static inline long cond_wait_interruptible_timeout_irqrestore(
        wait_queue_head_t *q, long timeout,
        spinlock_t *lock, unsigned long flags )
 {
+       DEFINE_WAIT(wait);
 
-       wait_queue_t wait;
-
-
-       init_waitqueue_entry( &wait, current );
-
-       set_current_state( TASK_INTERRUPTIBLE );
-
-       add_wait_queue( q, &wait );
-
-       spin_unlock_irqrestore( lock, flags );
-
+       prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE);
+       spin_unlock_irqrestore(lock, flags);
        timeout = schedule_timeout(timeout);
+       finish_wait(q, &wait);
 
-       remove_wait_queue( q, &wait );
-
-       return( timeout );
-
+       return timeout;
 }
 
 
@@ -1528,7 +1522,7 @@ dbg( "digi_open: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_cou
 
 static void digi_close( struct usb_serial_port *port, struct file *filp )
 {
-
+       DEFINE_WAIT(wait);
        int ret;
        unsigned char buf[32];
        struct tty_struct *tty = port->tty;
@@ -1604,8 +1598,9 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
                        dbg( "digi_close: write oob failed, ret=%d", ret );
 
                /* wait for final commands on oob port to complete */
-               interruptible_sleep_on_timeout( &priv->dp_flush_wait,
-                       DIGI_CLOSE_TIMEOUT );
+               prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE);
+               schedule_timeout(DIGI_CLOSE_TIMEOUT);
+               finish_wait(&priv->dp_flush_wait, &wait);
 
                /* shutdown any outstanding bulk writes */
                usb_kill_urb(port->write_urb);