diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 14:51:50 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 11:30:21 -0800 |
commit | 1a54a76d5171f3ffd89eb69f6f38d535724e3d05 (patch) | |
tree | 6d6491bdddb6356dd08813299f1af49c1b1ddc5f /include/linux/tty_driver.h | |
parent | a8fbc974c347a798fd0c6f0bffe7bf46b8c6dfb6 (diff) | |
download | linux-rpi3-1a54a76d5171f3ffd89eb69f6f38d535724e3d05.tar.gz linux-rpi3-1a54a76d5171f3ffd89eb69f6f38d535724e3d05.tar.bz2 linux-rpi3-1a54a76d5171f3ffd89eb69f6f38d535724e3d05.zip |
TTY: let alloc_tty_driver deduce the owner automatically
Like the rest of the kernel, make a stub from alloc_tty_driver which
calls __alloc_tty_driver with proper owner. This will save us one more
assignment on the driver side.
Also this fixes some drivers which didn't set the owner. This allowed
user to remove the module from the system even though a tty from the
driver is still open.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/tty_driver.h')
-rw-r--r-- | include/linux/tty_driver.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 5cf685086dd3..6e65493a5e6c 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -234,6 +234,7 @@ * if provided (otherwise EINVAL will be returned). */ +#include <linux/export.h> #include <linux/fs.h> #include <linux/list.h> #include <linux/cdev.h> @@ -324,7 +325,7 @@ struct tty_driver { extern struct list_head tty_drivers; -extern struct tty_driver *alloc_tty_driver(int lines); +extern struct tty_driver *__alloc_tty_driver(int lines, struct module *owner); extern void put_tty_driver(struct tty_driver *driver); extern void tty_set_operations(struct tty_driver *driver, const struct tty_operations *op); @@ -332,6 +333,8 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line); extern void tty_driver_kref_put(struct tty_driver *driver); +#define alloc_tty_driver(lines) __alloc_tty_driver(lines, THIS_MODULE) + static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) { kref_get(&d->kref); |