diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-09-09 19:45:42 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2012-03-24 19:29:53 -0400 |
commit | cfe6b7c79daa0efa27f474f1fe2a88fd7af5cc47 (patch) | |
tree | 5030f25d83451e3b3e579bac4b9a2e561990048d /arch/um/drivers/stdio_console.c | |
parent | 31efcebb7d7196adcee73027f513d7c0bf572b47 (diff) |
um: switch line.c tty drivers to dynamic device creation
Current code doesn't update the symlinks in /sys/dev/char when we add/remove
tty lines. Fixing that allows to stop messing with ->valid before the driver
registration, which is a Good Thing(tm) - we shouldn't have it set before we
really have the things set up and ready for line_open().
We need tty_driver available to call tty_{un,}register_device(), so we just
stash a reference to it into struct line_driver.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/drivers/stdio_console.c')
-rw-r--r-- | arch/um/drivers/stdio_console.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index f8d4325b28b7..32bd040138f0 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c | |||
@@ -27,12 +27,6 @@ | |||
27 | 27 | ||
28 | #define MAX_TTYS (16) | 28 | #define MAX_TTYS (16) |
29 | 29 | ||
30 | /* Referenced only by tty_driver below - presumably it's locked correctly | ||
31 | * by the tty driver. | ||
32 | */ | ||
33 | |||
34 | static struct tty_driver *console_driver; | ||
35 | |||
36 | static void stdio_announce(char *dev_name, int dev) | 30 | static void stdio_announce(char *dev_name, int dev) |
37 | { | 31 | { |
38 | printk(KERN_INFO "Virtual console %d assigned device '%s'\n", dev, | 32 | printk(KERN_INFO "Virtual console %d assigned device '%s'\n", dev, |
@@ -137,7 +131,7 @@ static void uml_console_write(struct console *console, const char *string, | |||
137 | static struct tty_driver *uml_console_device(struct console *c, int *index) | 131 | static struct tty_driver *uml_console_device(struct console *c, int *index) |
138 | { | 132 | { |
139 | *index = c->index; | 133 | *index = c->index; |
140 | return console_driver; | 134 | return driver.driver; |
141 | } | 135 | } |
142 | 136 | ||
143 | static int uml_console_setup(struct console *co, char *options) | 137 | static int uml_console_setup(struct console *co, char *options) |
@@ -160,6 +154,7 @@ static struct console stdiocons = { | |||
160 | static int stdio_init(void) | 154 | static int stdio_init(void) |
161 | { | 155 | { |
162 | char *new_title; | 156 | char *new_title; |
157 | int err; | ||
163 | int i; | 158 | int i; |
164 | 159 | ||
165 | for (i = 0; i < MAX_TTYS; i++) { | 160 | for (i = 0; i < MAX_TTYS; i++) { |
@@ -168,18 +163,16 @@ static int stdio_init(void) | |||
168 | s = def_conf; | 163 | s = def_conf; |
169 | if (!s) | 164 | if (!s) |
170 | s = i ? CONFIG_CON_CHAN : CONFIG_CON_ZERO_CHAN; | 165 | s = i ? CONFIG_CON_CHAN : CONFIG_CON_ZERO_CHAN; |
171 | if (s && strcmp(s, "none") != 0) { | 166 | if (s && strcmp(s, "none") != 0) |
172 | vts[i].init_str = s; | 167 | vts[i].init_str = s; |
173 | vts[i].valid = 1; | ||
174 | } | ||
175 | spin_lock_init(&vts[i].lock); | 168 | spin_lock_init(&vts[i].lock); |
176 | mutex_init(&vts[i].count_lock); | 169 | mutex_init(&vts[i].count_lock); |
177 | vts[i].driver = &driver; | 170 | vts[i].driver = &driver; |
178 | } | 171 | } |
179 | console_driver = register_lines(&driver, &console_ops, vts, | 172 | err = register_lines(&driver, &console_ops, vts, |
180 | ARRAY_SIZE(vts)); | 173 | ARRAY_SIZE(vts)); |
181 | if (console_driver == NULL) | 174 | if (err) |
182 | return -1; | 175 | return err; |
183 | printk(KERN_INFO "Initialized stdio console driver\n"); | 176 | printk(KERN_INFO "Initialized stdio console driver\n"); |
184 | 177 | ||
185 | new_title = add_xterm_umid(opts.xterm_title); | 178 | new_title = add_xterm_umid(opts.xterm_title); |