TTY: move cdev_add to tty_register_device

We need the /dev/ node not to be available before we call
tty_register_device. Otherwise we might race with open and
tty_struct->port might not be available at that time.

This is not an issue now, but would be a problem after "TTY: use
tty_port_register_device" is applied.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby 2012-08-08 22:26:44 +02:00 committed by Greg Kroah-Hartman
parent 0019b4089c
commit 7e73eca6a7
2 changed files with 42 additions and 8 deletions

View file

@ -289,7 +289,7 @@ struct tty_operations {
struct tty_driver {
int magic; /* magic number for this structure */
struct kref kref; /* Reference management */
struct cdev cdev;
struct cdev *cdevs;
struct module *owner;
const char *driver_name;
const char *name;