diff options
author | Alan Cox <alan@redhat.com> | 2008-10-13 05:42:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:42 -0400 |
commit | 7d7b93c1452f381350dbaf276a63357fa6559e6d (patch) | |
tree | 02ce0c37e7fea66d1e8af20111d92171bfc0ff1d /include/linux/tty_driver.h | |
parent | 99f1fe189daf8e99a847e420567e49dd7ee2aae7 (diff) |
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 2c5c35c4656f..ba891dd23550 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -253,6 +253,7 @@ struct tty_operations { | |||
253 | 253 | ||
254 | struct tty_driver { | 254 | struct tty_driver { |
255 | int magic; /* magic number for this structure */ | 255 | int magic; /* magic number for this structure */ |
256 | struct kref kref; /* Reference management */ | ||
256 | struct cdev cdev; | 257 | struct cdev cdev; |
257 | struct module *owner; | 258 | struct module *owner; |
258 | const char *driver_name; | 259 | const char *driver_name; |
@@ -266,7 +267,6 @@ struct tty_driver { | |||
266 | short subtype; /* subtype of tty driver */ | 267 | short subtype; /* subtype of tty driver */ |
267 | struct ktermios init_termios; /* Initial termios */ | 268 | struct ktermios init_termios; /* Initial termios */ |
268 | int flags; /* tty driver flags */ | 269 | int flags; /* tty driver flags */ |
269 | int refcount; /* for loadable tty drivers */ | ||
270 | struct proc_dir_entry *proc_entry; /* /proc fs entry */ | 270 | struct proc_dir_entry *proc_entry; /* /proc fs entry */ |
271 | struct tty_driver *other; /* only used for the PTY driver */ | 271 | struct tty_driver *other; /* only used for the PTY driver */ |
272 | 272 | ||
@@ -288,12 +288,19 @@ struct tty_driver { | |||
288 | 288 | ||
289 | extern struct list_head tty_drivers; | 289 | extern struct list_head tty_drivers; |
290 | 290 | ||
291 | struct tty_driver *alloc_tty_driver(int lines); | 291 | extern struct tty_driver *alloc_tty_driver(int lines); |
292 | void put_tty_driver(struct tty_driver *driver); | 292 | extern void put_tty_driver(struct tty_driver *driver); |
293 | void tty_set_operations(struct tty_driver *driver, | 293 | extern void tty_set_operations(struct tty_driver *driver, |
294 | const struct tty_operations *op); | 294 | const struct tty_operations *op); |
295 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | 295 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); |
296 | 296 | ||
297 | extern void tty_driver_kref_put(struct tty_driver *driver); | ||
298 | extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) | ||
299 | { | ||
300 | kref_get(&d->kref); | ||
301 | return d; | ||
302 | } | ||
303 | |||
297 | /* tty driver magic number */ | 304 | /* tty driver magic number */ |
298 | #define TTY_DRIVER_MAGIC 0x5402 | 305 | #define TTY_DRIVER_MAGIC 0x5402 |
299 | 306 | ||