Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6ed1db...
Commit: 6ed1dbaeadd62a026a93aa3ac8680d2dfe9f96b3
Parent: 3969ffba71d39ced700d09d9cfde83174396299e
Author: Alan Cox <alan@redhat.com>
AuthorDate: Fri Jan 2 13:48:11 2009 +0000
Committer: Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Fri Jan 2 10:19:41 2009 -0800
tty: Make epca use the port helpers
Now the locking is straight and the port kref usage is straight we can
replace lots of chunks of code with the standard port helpers
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
drivers/char/epca.c | 172 +++++++----------------------------------------
drivers/char/tty_port.c | 3 +-
2 files changed, 26 insertions(+), 149 deletions(-)
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 7a69705..71225d1 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -432,58 +432,15 @@ static void pc_close(struct tty_struct *tty, struct file *filp)
return;
port = &ch->port;
- spin_lock_irqsave(&port->lock, flags);
- if (tty_hung_up_p(filp)) {
- spin_unlock_irqrestore(&port->lock, flags);
- return;
- }
- if (port->count-- > 1) {
- /* Begin channel is open more than once */
- /*
- * Return without doing anything. Someone might still
- * be using the channel.
- */
- spin_unlock_irqrestore(&port->lock, flags);
+ if (tty_port_close_start(port, tty, filp) == 0)
return;
- }
- /* Port open only once go ahead with shutdown & reset */
- WARN_ON(port->count < 0);
- /*
- * Let the rest of the driver know the channel is being closed.
- * This becomes important if an open is attempted before close
- * is finished.
- */
- port->flags |= ASYNC_CLOSING;
- tty->closing = 1;
-
- spin_unlock_irqrestore(&port->lock, flags);
-
- if (port->flags & ASYNC_INITIALIZED) {
- /* Setup an event to ...