diff options
Diffstat (limited to 'arch/um/drivers/stdio_console.c')
-rw-r--r-- | arch/um/drivers/stdio_console.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index 005aa6333b6e..61db8b2fc83f 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c | |||
@@ -75,7 +75,7 @@ static struct line_driver driver = { | |||
75 | .name = "con", | 75 | .name = "con", |
76 | .config = con_config, | 76 | .config = con_config, |
77 | .get_config = con_get_config, | 77 | .get_config = con_get_config, |
78 | .id = line_id, | 78 | .id = line_id, |
79 | .remove = con_remove, | 79 | .remove = con_remove, |
80 | }, | 80 | }, |
81 | }; | 81 | }; |
@@ -86,28 +86,27 @@ static struct lines console_lines = LINES_INIT(MAX_TTYS); | |||
86 | * individual elements are protected by individual semaphores. | 86 | * individual elements are protected by individual semaphores. |
87 | */ | 87 | */ |
88 | struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver), | 88 | struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver), |
89 | [ 1 ... MAX_TTYS - 1 ] = | 89 | [ 1 ... MAX_TTYS - 1 ] = |
90 | LINE_INIT(CONFIG_CON_CHAN, &driver) }; | 90 | LINE_INIT(CONFIG_CON_CHAN, &driver) }; |
91 | 91 | ||
92 | static int con_config(char *str) | 92 | static int con_config(char *str) |
93 | { | 93 | { |
94 | return(line_config(vts, sizeof(vts)/sizeof(vts[0]), str)); | 94 | return line_config(vts, ARRAY_SIZE(vts), str, &opts); |
95 | } | 95 | } |
96 | 96 | ||
97 | static int con_get_config(char *dev, char *str, int size, char **error_out) | 97 | static int con_get_config(char *dev, char *str, int size, char **error_out) |
98 | { | 98 | { |
99 | return(line_get_config(dev, vts, sizeof(vts)/sizeof(vts[0]), str, | 99 | return line_get_config(dev, vts, ARRAY_SIZE(vts), str, size, error_out); |
100 | size, error_out)); | ||
101 | } | 100 | } |
102 | 101 | ||
103 | static int con_remove(int n) | 102 | static int con_remove(int n) |
104 | { | 103 | { |
105 | return line_remove(vts, sizeof(vts)/sizeof(vts[0]), n); | 104 | return line_remove(vts, ARRAY_SIZE(vts), n); |
106 | } | 105 | } |
107 | 106 | ||
108 | static int con_open(struct tty_struct *tty, struct file *filp) | 107 | static int con_open(struct tty_struct *tty, struct file *filp) |
109 | { | 108 | { |
110 | return line_open(vts, tty, &opts); | 109 | return line_open(vts, tty); |
111 | } | 110 | } |
112 | 111 | ||
113 | static int con_init_done = 0; | 112 | static int con_init_done = 0; |
@@ -117,16 +116,18 @@ static struct tty_operations console_ops = { | |||
117 | .close = line_close, | 116 | .close = line_close, |
118 | .write = line_write, | 117 | .write = line_write, |
119 | .put_char = line_put_char, | 118 | .put_char = line_put_char, |
120 | .write_room = line_write_room, | 119 | .write_room = line_write_room, |
121 | .chars_in_buffer = line_chars_in_buffer, | 120 | .chars_in_buffer = line_chars_in_buffer, |
122 | .flush_buffer = line_flush_buffer, | 121 | .flush_buffer = line_flush_buffer, |
123 | .flush_chars = line_flush_chars, | 122 | .flush_chars = line_flush_chars, |
124 | .set_termios = line_set_termios, | 123 | .set_termios = line_set_termios, |
125 | .ioctl = line_ioctl, | 124 | .ioctl = line_ioctl, |
125 | .throttle = line_throttle, | ||
126 | .unthrottle = line_unthrottle, | ||
126 | }; | 127 | }; |
127 | 128 | ||
128 | static void uml_console_write(struct console *console, const char *string, | 129 | static void uml_console_write(struct console *console, const char *string, |
129 | unsigned len) | 130 | unsigned len) |
130 | { | 131 | { |
131 | struct line *line = &vts[console->index]; | 132 | struct line *line = &vts[console->index]; |
132 | unsigned long flags; | 133 | unsigned long flags; |
@@ -146,7 +147,7 @@ static int uml_console_setup(struct console *co, char *options) | |||
146 | { | 147 | { |
147 | struct line *line = &vts[co->index]; | 148 | struct line *line = &vts[co->index]; |
148 | 149 | ||
149 | return console_open_chan(line,co,&opts); | 150 | return console_open_chan(line, co, &opts); |
150 | } | 151 | } |
151 | 152 | ||
152 | static struct console stdiocons = { | 153 | static struct console stdiocons = { |
@@ -156,7 +157,7 @@ static struct console stdiocons = { | |||
156 | .setup = uml_console_setup, | 157 | .setup = uml_console_setup, |
157 | .flags = CON_PRINTBUFFER, | 158 | .flags = CON_PRINTBUFFER, |
158 | .index = -1, | 159 | .index = -1, |
159 | .data = &vts, | 160 | .data = &vts, |
160 | }; | 161 | }; |
161 | 162 | ||
162 | int stdio_init(void) | 163 | int stdio_init(void) |
@@ -166,11 +167,11 @@ int stdio_init(void) | |||
166 | console_driver = line_register_devfs(&console_lines, &driver, | 167 | console_driver = line_register_devfs(&console_lines, &driver, |
167 | &console_ops, vts, | 168 | &console_ops, vts, |
168 | ARRAY_SIZE(vts)); | 169 | ARRAY_SIZE(vts)); |
169 | if (NULL == console_driver) | 170 | if (console_driver == NULL) |
170 | return -1; | 171 | return -1; |
171 | printk(KERN_INFO "Initialized stdio console driver\n"); | 172 | printk(KERN_INFO "Initialized stdio console driver\n"); |
172 | 173 | ||
173 | lines_init(vts, sizeof(vts)/sizeof(vts[0])); | 174 | lines_init(vts, ARRAY_SIZE(vts), &opts); |
174 | 175 | ||
175 | new_title = add_xterm_umid(opts.xterm_title); | 176 | new_title = add_xterm_umid(opts.xterm_title); |
176 | if(new_title != NULL) | 177 | if(new_title != NULL) |
@@ -178,7 +179,7 @@ int stdio_init(void) | |||
178 | 179 | ||
179 | con_init_done = 1; | 180 | con_init_done = 1; |
180 | register_console(&stdiocons); | 181 | register_console(&stdiocons); |
181 | return(0); | 182 | return 0; |
182 | } | 183 | } |
183 | late_initcall(stdio_init); | 184 | late_initcall(stdio_init); |
184 | 185 | ||
@@ -186,13 +187,13 @@ static void console_exit(void) | |||
186 | { | 187 | { |
187 | if (!con_init_done) | 188 | if (!con_init_done) |
188 | return; | 189 | return; |
189 | close_lines(vts, sizeof(vts)/sizeof(vts[0])); | 190 | close_lines(vts, ARRAY_SIZE(vts)); |
190 | } | 191 | } |
191 | __uml_exitcall(console_exit); | 192 | __uml_exitcall(console_exit); |
192 | 193 | ||
193 | static int console_chan_setup(char *str) | 194 | static int console_chan_setup(char *str) |
194 | { | 195 | { |
195 | return(line_setup(vts, sizeof(vts)/sizeof(vts[0]), str, 1)); | 196 | return line_setup(vts, ARRAY_SIZE(vts), str); |
196 | } | 197 | } |
197 | __setup("con", console_chan_setup); | 198 | __setup("con", console_chan_setup); |
198 | __channel_help(console_chan_setup, "con"); | 199 | __channel_help(console_chan_setup, "con"); |