aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_port.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2009-01-02 08:45:26 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:19:38 -0500
commit3e61696bdc2103107674b06d0daf30b76193e922 (patch)
treecc4f2b7b7b0ce2162613bb9d3cf819f6bbfd3628 /drivers/char/tty_port.c
parent5d951fb458f847e5485b5251597fbf326000bb3b (diff)
isicom: redo locking to use tty port locks
This helps set the basis for moving block_til_ready into common code. We also introduce a tty_port_hangup helper as this will also be generally needed. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/tty_port.c')
-rw-r--r--drivers/char/tty_port.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
index 0557b6384747..9f418bca4a22 100644
--- a/drivers/char/tty_port.c
+++ b/drivers/char/tty_port.c
@@ -7,6 +7,7 @@
7#include <linux/tty.h> 7#include <linux/tty.h>
8#include <linux/tty_driver.h> 8#include <linux/tty_driver.h>
9#include <linux/tty_flip.h> 9#include <linux/tty_flip.h>
10#include <linux/serial.h>
10#include <linux/timer.h> 11#include <linux/timer.h>
11#include <linux/string.h> 12#include <linux/string.h>
12#include <linux/slab.h> 13#include <linux/slab.h>
@@ -96,6 +97,29 @@ void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty)
96EXPORT_SYMBOL(tty_port_tty_set); 97EXPORT_SYMBOL(tty_port_tty_set);
97 98
98/** 99/**
100 * tty_port_hangup - hangup helper
101 * @port: tty port
102 *
103 * Perform port level tty hangup flag and count changes. Drop the tty
104 * reference.
105 */
106
107void tty_port_hangup(struct tty_port *port)
108{
109 unsigned long flags;
110
111 spin_lock_irqsave(&port->lock, flags);
112 port->count = 0;
113 port->flags &= ~ASYNC_NORMAL_ACTIVE;
114 if (port->tty)
115 tty_kref_put(port->tty);
116 port->tty = NULL;
117 spin_unlock_irqrestore(&port->lock, flags);
118 wake_up_interruptible(&port->open_wait);
119}
120EXPORT_SYMBOL(tty_port_hangup);
121
122/**
99 * tty_port_carrier_raised - carrier raised check 123 * tty_port_carrier_raised - carrier raised check
100 * @port: tty port 124 * @port: tty port
101 * 125 *