瀏覽代碼

tty: use prepare/finish_wait

Use prepare_to_wait and finish_wait instead of add_wait_queue and
remove_wait_queue.

This avoids us setting a task state.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jiri Slaby 16 年之前
父節點
當前提交
3e3b5c0877
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      drivers/char/tty_port.c

+ 2 - 4
drivers/char/tty_port.c

@@ -222,7 +222,6 @@ int tty_port_block_til_ready(struct tty_port *port,
 	   before the next open may complete */
 	   before the next open may complete */
 
 
 	retval = 0;
 	retval = 0;
-	add_wait_queue(&port->open_wait, &wait);
 
 
 	/* The port lock protects the port counts */
 	/* The port lock protects the port counts */
 	spin_lock_irqsave(&port->lock, flags);
 	spin_lock_irqsave(&port->lock, flags);
@@ -236,7 +235,7 @@ int tty_port_block_til_ready(struct tty_port *port,
 		if (tty->termios->c_cflag & CBAUD)
 		if (tty->termios->c_cflag & CBAUD)
 			tty_port_raise_dtr_rts(port);
 			tty_port_raise_dtr_rts(port);
 
 
-		set_current_state(TASK_INTERRUPTIBLE);
+		prepare_to_wait(&port->open_wait, &wait, TASK_INTERRUPTIBLE);
 		/* Check for a hangup or uninitialised port. Return accordingly */
 		/* Check for a hangup or uninitialised port. Return accordingly */
 		if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) {
 		if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) {
 			if (port->flags & ASYNC_HUP_NOTIFY)
 			if (port->flags & ASYNC_HUP_NOTIFY)
@@ -257,8 +256,7 @@ int tty_port_block_til_ready(struct tty_port *port,
 		}
 		}
 		schedule();
 		schedule();
 	}
 	}
-	set_current_state(TASK_RUNNING);
-	remove_wait_queue(&port->open_wait, &wait);
+	finish_wait(&port->open_wait, &wait);
 
 
 	/* Update counts. A parallel hangup will have set count to zero and
 	/* Update counts. A parallel hangup will have set count to zero and
 	   we must not mess that up further */
 	   we must not mess that up further */