mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] Char: tty, remove sleep_on
@ 2009-06-10 12:08 Jiri Slaby
  2009-06-10 12:08 ` [PATCH 2/2] Char: tty, use prepare/finish_wait Jiri Slaby
  2009-06-10 15:53 ` [PATCH 1/2] Char: tty, remove sleep_on Alan Cox
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-06-10 12:08 UTC (permalink / raw)
  To: alan; +Cc: akpm, linux-kernel, Jiri Slaby

Use wait_event instead of sleep_on in tty_block_til_ready.

Wait for ASYNC_CLOSING flag being 0.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/char/tty_port.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
index 4d08b6d..931af10 100644
--- a/drivers/char/tty_port.c
+++ b/drivers/char/tty_port.c
@@ -198,7 +198,8 @@ int tty_port_block_til_ready(struct tty_port *port,
 
 	/* block if port is in the process of being closed */
 	if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) {
-		interruptible_sleep_on(&port->close_wait);
+		wait_event_interruptible(port->close_wait,
+				!(port->flags & ASYNC_CLOSING));
 		if (port->flags & ASYNC_HUP_NOTIFY)
 			return -EAGAIN;
 		else
-- 
1.6.3.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Char: tty, use prepare/finish_wait
  2009-06-10 12:08 [PATCH 1/2] Char: tty, remove sleep_on Jiri Slaby
@ 2009-06-10 12:08 ` Jiri Slaby
  2009-06-10 15:53 ` [PATCH 1/2] Char: tty, remove sleep_on Alan Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-06-10 12:08 UTC (permalink / raw)
  To: alan; +Cc: akpm, linux-kernel, Jiri Slaby

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>
---
 drivers/char/tty_port.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
index 931af10..62dadfc 100644
--- a/drivers/char/tty_port.c
+++ b/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 */
 
 	retval = 0;
-	add_wait_queue(&port->open_wait, &wait);
 
 	/* The port lock protects the port counts */
 	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)
 			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 */
 		if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) {
 			if (port->flags & ASYNC_HUP_NOTIFY)
@@ -257,8 +256,7 @@ int tty_port_block_til_ready(struct tty_port *port,
 		}
 		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
 	   we must not mess that up further */
-- 
1.6.3.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Char: tty, remove sleep_on
  2009-06-10 12:08 [PATCH 1/2] Char: tty, remove sleep_on Jiri Slaby
  2009-06-10 12:08 ` [PATCH 2/2] Char: tty, use prepare/finish_wait Jiri Slaby
@ 2009-06-10 15:53 ` Alan Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2009-06-10 15:53 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: akpm, linux-kernel, Jiri Slaby

On Wed, 10 Jun 2009 14:08:03 +0200
Jiri Slaby <jirislaby@gmail.com> wrote:

> Use wait_event instead of sleep_on in tty_block_til_ready.
> 
> Wait for ASYNC_CLOSING flag being 0.

Both applied

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-10 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-10 12:08 [PATCH 1/2] Char: tty, remove sleep_on Jiri Slaby
2009-06-10 12:08 ` [PATCH 2/2] Char: tty, use prepare/finish_wait Jiri Slaby
2009-06-10 15:53 ` [PATCH 1/2] Char: tty, remove sleep_on Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®