#include <linux/workqueue.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
+#include <linux/wait.h>
#include "usb-serial.h"
/* Defines */
* 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;
}
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;
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);