[PATCH] uml: console whitespace and comment tidying
[powerpc.git] / arch / um / drivers / stdio_console.c
index 8f3b168..0b1bca4 100644 (file)
@@ -3,7 +3,6 @@
  * Licensed under the GPL
  */
 
-#include "linux/config.h"
 #include "linux/posix_types.h"
 #include "linux/tty.h"
 #include "linux/tty_flip.h"
@@ -31,8 +30,6 @@
 
 #define MAX_TTYS (16)
 
-/* ----------------------------------------------------------------------------- */
-
 /* Referenced only by tty_driver below - presumably it's locked correctly
  * by the tty driver.
  */
@@ -53,14 +50,13 @@ static struct chan_opts opts = {
        .in_kernel      = 1,
 };
 
-static int con_config(char *str);
+static int con_config(char *str, char **error_out);
 static int con_get_config(char *dev, char *str, int size, char **error_out);
-static int con_remove(int n);
+static int con_remove(int n, char **con_remove);
 
 static struct line_driver driver = {
        .name                   = "UML console",
        .device_name            = "tty",
-       .devfs_name             = "vc/",
        .major                  = TTY_MAJOR,
        .minor_start            = 0,
        .type                   = TTY_DRIVER_TYPE_CONSOLE,
@@ -85,34 +81,34 @@ static struct lines console_lines = LINES_INIT(MAX_TTYS);
 /* The array is initialized by line_init, which is an initcall.  The 
  * individual elements are protected by individual semaphores.
  */
-struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver),
-                             [ 1 ... MAX_TTYS - 1 ] =
-                             LINE_INIT(CONFIG_CON_CHAN, &driver) };
+static struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver),
+                                    [ 1 ... MAX_TTYS - 1 ] =
+                                    LINE_INIT(CONFIG_CON_CHAN, &driver) };
 
-static int con_config(char *str)
+static int con_config(char *str, char **error_out)
 {
-       return line_config(vts, sizeof(vts)/sizeof(vts[0]), str);
+       return line_config(vts, ARRAY_SIZE(vts), str, &opts, error_out);
 }
 
 static int con_get_config(char *dev, char *str, int size, char **error_out)
 {
-       return line_get_config(dev, vts, sizeof(vts)/sizeof(vts[0]), str,
-                              size, error_out);
+       return line_get_config(dev, vts, ARRAY_SIZE(vts), str, size, error_out);
 }
 
-static int con_remove(int n)
+static int con_remove(int n, char **error_out)
 {
-       return line_remove(vts, sizeof(vts)/sizeof(vts[0]), n);
+       return line_remove(vts, ARRAY_SIZE(vts), n, error_out);
 }
 
 static int con_open(struct tty_struct *tty, struct file *filp)
 {
-       return line_open(vts, tty, &opts);
+       return line_open(vts, tty);
 }
 
+/* Set in an initcall, checked in an exitcall */
 static int con_init_done = 0;
 
-static struct tty_operations console_ops = {
+static const struct tty_operations console_ops = {
        .open                   = con_open,
        .close                  = line_close,
        .write                  = line_write,
@@ -123,6 +119,8 @@ static struct tty_operations console_ops = {
        .flush_chars            = line_flush_chars,
        .set_termios            = line_set_termios,
        .ioctl                  = line_ioctl,
+       .throttle               = line_throttle,
+       .unthrottle             = line_unthrottle,
 };
 
 static void uml_console_write(struct console *console, const char *string,
@@ -170,7 +168,7 @@ int stdio_init(void)
                return -1;
        printk(KERN_INFO "Initialized stdio console driver\n");
 
-       lines_init(vts, sizeof(vts)/sizeof(vts[0]));
+       lines_init(vts, ARRAY_SIZE(vts), &opts);
 
        new_title = add_xterm_umid(opts.xterm_title);
        if(new_title != NULL)
@@ -186,13 +184,21 @@ static void console_exit(void)
 {
        if (!con_init_done)
                return;
-       close_lines(vts, sizeof(vts)/sizeof(vts[0]));
+       close_lines(vts, ARRAY_SIZE(vts));
 }
 __uml_exitcall(console_exit);
 
 static int console_chan_setup(char *str)
 {
-       return line_setup(vts, sizeof(vts)/sizeof(vts[0]), str, 1);
+       char *error;
+       int ret;
+
+       ret = line_setup(vts, ARRAY_SIZE(vts), str, &error);
+       if(ret < 0)
+               printk(KERN_ERR "Failed to set up console with "
+                      "configuration string \"%s\" : %s\n", str, error);
+
+       return 1;
 }
 __setup("con", console_chan_setup);
 __channel_help(console_chan_setup, "con");