diff options
author | Alan Cox <alan@redhat.com> | 2008-10-13 10:42:09 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 09:51:42 -0700 |
commit | 7d7b93c1452f381350dbaf276a63357fa6559e6d (patch) | |
tree | 02ce0c37e7fea66d1e8af20111d92171bfc0ff1d /include/linux/tty_driver.h | |
parent | 99f1fe189daf8e99a847e420567e49dd7ee2aae7 (diff) | |
download | op-kernel-dev-7d7b93c1452f381350dbaf276a63357fa6559e6d.zip op-kernel-dev-7d7b93c1452f381350dbaf276a63357fa6559e6d.tar.gz |
tty: kref the tty driver object
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/tty_driver.h')
-rw-r--r-- | include/linux/tty_driver.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 2c5c35c..ba891dd 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -253,6 +253,7 @@ struct tty_operations { struct tty_driver { int magic; /* magic number for this structure */ + struct kref kref; /* Reference management */ struct cdev cdev; struct module *owner; const char *driver_name; @@ -266,7 +267,6 @@ struct tty_driver { short subtype; /* subtype of tty driver */ struct ktermios init_termios; /* Initial termios */ int flags; /* tty driver flags */ - int refcount; /* for loadable tty drivers */ struct proc_dir_entry *proc_entry; /* /proc fs entry */ struct tty_driver *other; /* only used for the PTY driver */ @@ -288,12 +288,19 @@ struct tty_driver { extern struct list_head tty_drivers; -struct tty_driver *alloc_tty_driver(int lines); -void put_tty_driver(struct tty_driver *driver); -void tty_set_operations(struct tty_driver *driver, +extern struct tty_driver *alloc_tty_driver(int lines); +extern void put_tty_driver(struct tty_driver *driver); +extern void tty_set_operations(struct tty_driver *driver, const struct tty_operations *op); extern struct tty_driver *tty_find_polling_driver(char *name, int *line); +extern void tty_driver_kref_put(struct tty_driver *driver); +extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) +{ + kref_get(&d->kref); + return d; +} + /* tty driver magic number */ #define TTY_DRIVER_MAGIC 0x5402 |