aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/stdio_console.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-09-09 19:45:42 -0400
committerRichard Weinberger <richard@nod.at>2012-03-25 00:29:53 +0100
commitcfe6b7c79daa0efa27f474f1fe2a88fd7af5cc47 (patch)
tree5030f25d83451e3b3e579bac4b9a2e561990048d /arch/um/drivers/stdio_console.c
parentum: fix races between line_open() and line_config() (diff)
downloadlinux-dev-cfe6b7c79daa0efa27f474f1fe2a88fd7af5cc47.tar.xz
linux-dev-cfe6b7c79daa0efa27f474f1fe2a88fd7af5cc47.zip
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 '')
-rw-r--r--arch/um/drivers/stdio_console.c19
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 @@
#define MAX_TTYS (16)
-/* Referenced only by tty_driver below - presumably it's locked correctly
- * by the tty driver.
- */
-
-static struct tty_driver *console_driver;
-
static void stdio_announce(char *dev_name, int dev)
{
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,
static struct tty_driver *uml_console_device(struct console *c, int *index)
{
*index = c->index;
- return console_driver;
+ return driver.driver;
}
static int uml_console_setup(struct console *co, char *options)
@@ -160,6 +154,7 @@ static struct console stdiocons = {
static int stdio_init(void)
{
char *new_title;
+ int err;
int i;
for (i = 0; i < MAX_TTYS; i++) {
@@ -168,18 +163,16 @@ static int stdio_init(void)
s = def_conf;
if (!s)
s = i ? CONFIG_CON_CHAN : CONFIG_CON_ZERO_CHAN;
- if (s && strcmp(s, "none") != 0) {
+ if (s && strcmp(s, "none") != 0)
vts[i].init_str = s;
- vts[i].valid = 1;
- }
spin_lock_init(&vts[i].lock);
mutex_init(&vts[i].count_lock);
vts[i].driver = &driver;
}
- console_driver = register_lines(&driver, &console_ops, vts,
+ err = register_lines(&driver, &console_ops, vts,
ARRAY_SIZE(vts));
- if (console_driver == NULL)
- return -1;
+ if (err)
+ return err;
printk(KERN_INFO "Initialized stdio console driver\n");
new_title = add_xterm_umid(opts.xterm_title);