aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-11-30 13:17:14 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 15:18:07 -0800
commit568aafc627e2978509e8a80c640ba534d1e843cc (patch)
tree1a24c5c0fc3a56054fa054a0255c04e5b7848daa /include
parent338818fd802a6baacb7e5b6910d52c8996ca6d28 (diff)
downloadmrst-s0i3-test-568aafc627e2978509e8a80c640ba534d1e843cc.tar.gz
mrst-s0i3-test-568aafc627e2978509e8a80c640ba534d1e843cc.tar.xz
mrst-s0i3-test-568aafc627e2978509e8a80c640ba534d1e843cc.zip
tty: tty_port: Add a kref object to the tty port
Users of tty port need a way to refcount ports when hotplugging is involved. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/tty.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index e9269ca1542..e6da667ba34 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -199,6 +199,8 @@ struct tty_port_operations {
/* FIXME: long term getting the tty argument *out* of this would be
good for consoles */
int (*activate)(struct tty_port *port, struct tty_struct *tty);
+ /* Called on the final put of a port */
+ void (*destruct)(struct tty_port *port);
};
struct tty_port {
@@ -219,6 +221,7 @@ struct tty_port {
int drain_delay; /* Set to zero if no pure time
based drain is needed else
set to size of fifo */
+ struct kref kref; /* Ref counter */
};
/*
@@ -461,6 +464,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay);
extern void tty_port_init(struct tty_port *port);
extern int tty_port_alloc_xmit_buf(struct tty_port *port);
extern void tty_port_free_xmit_buf(struct tty_port *port);
+extern void tty_port_put(struct tty_port *port);
+
+extern inline struct tty_port *tty_port_get(struct tty_port *port)
+{
+ if (port)
+ kref_get(&port->kref);
+ return port;
+}
+
extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
extern int tty_port_carrier_raised(struct tty_port *port);