aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-01-06 03:18:50 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:45 -0500
commitd50084a2991f3d9490d5c0f3af72e6fe1515a493 (patch)
tree051d6c46ddab1ee47db40252cdad4cbbe0a04f5b /arch/um/drivers
parent1b57e9c27882a908f180d4daf72ee12c6f137178 (diff)
[PATCH] uml: Formatting changes
This patch makes a bunch of non-functional changes - return(foo); becomes return foo; some statements are broken across lines for readability some trailing whitespace is cleaned up open_one_chan took four arguments, three of which could be deduced from the first. Accordingly, they were eliminated. some examples of "} else {" had a newline added some whitespace cleanup in the indentation lines_init got some control flow cleanup some long lines were broken removed another emacs-specific C formatting comment Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r--arch/um/drivers/chan_kern.c124
-rw-r--r--arch/um/drivers/line.c47
-rw-r--r--arch/um/drivers/mconsole_kern.c25
-rw-r--r--arch/um/drivers/ssl.c29
-rw-r--r--arch/um/drivers/stdio_console.c26
5 files changed, 136 insertions, 115 deletions
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 5b58fad45290..8b1262e9fb66 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -58,7 +58,7 @@ static void *not_configged_init(char *str, int device, struct chan_opts *opts)
58{ 58{
59 my_puts("Using a channel type which is configured out of " 59 my_puts("Using a channel type which is configured out of "
60 "UML\n"); 60 "UML\n");
61 return(NULL); 61 return NULL;
62} 62}
63 63
64static int not_configged_open(int input, int output, int primary, void *data, 64static int not_configged_open(int input, int output, int primary, void *data,
@@ -66,7 +66,7 @@ static int not_configged_open(int input, int output, int primary, void *data,
66{ 66{
67 my_puts("Using a channel type which is configured out of " 67 my_puts("Using a channel type which is configured out of "
68 "UML\n"); 68 "UML\n");
69 return(-ENODEV); 69 return -ENODEV;
70} 70}
71 71
72static void not_configged_close(int fd, void *data) 72static void not_configged_close(int fd, void *data)
@@ -79,21 +79,21 @@ static int not_configged_read(int fd, char *c_out, void *data)
79{ 79{
80 my_puts("Using a channel type which is configured out of " 80 my_puts("Using a channel type which is configured out of "
81 "UML\n"); 81 "UML\n");
82 return(-EIO); 82 return -EIO;
83} 83}
84 84
85static int not_configged_write(int fd, const char *buf, int len, void *data) 85static int not_configged_write(int fd, const char *buf, int len, void *data)
86{ 86{
87 my_puts("Using a channel type which is configured out of " 87 my_puts("Using a channel type which is configured out of "
88 "UML\n"); 88 "UML\n");
89 return(-EIO); 89 return -EIO;
90} 90}
91 91
92static int not_configged_console_write(int fd, const char *buf, int len) 92static int not_configged_console_write(int fd, const char *buf, int len)
93{ 93{
94 my_puts("Using a channel type which is configured out of " 94 my_puts("Using a channel type which is configured out of "
95 "UML\n"); 95 "UML\n");
96 return(-EIO); 96 return -EIO;
97} 97}
98 98
99static int not_configged_window_size(int fd, void *data, unsigned short *rows, 99static int not_configged_window_size(int fd, void *data, unsigned short *rows,
@@ -101,7 +101,7 @@ static int not_configged_window_size(int fd, void *data, unsigned short *rows,
101{ 101{
102 my_puts("Using a channel type which is configured out of " 102 my_puts("Using a channel type which is configured out of "
103 "UML\n"); 103 "UML\n");
104 return(-ENODEV); 104 return -ENODEV;
105} 105}
106 106
107static void not_configged_free(void *data) 107static void not_configged_free(void *data)
@@ -135,17 +135,17 @@ int generic_read(int fd, char *c_out, void *unused)
135 n = os_read_file(fd, c_out, sizeof(*c_out)); 135 n = os_read_file(fd, c_out, sizeof(*c_out));
136 136
137 if(n == -EAGAIN) 137 if(n == -EAGAIN)
138 return(0); 138 return 0;
139 else if(n == 0) 139 else if(n == 0)
140 return(-EIO); 140 return -EIO;
141 return(n); 141 return n;
142} 142}
143 143
144/* XXX Trivial wrapper around os_write_file */ 144/* XXX Trivial wrapper around os_write_file */
145 145
146int generic_write(int fd, const char *buf, int n, void *unused) 146int generic_write(int fd, const char *buf, int n, void *unused)
147{ 147{
148 return(os_write_file(fd, buf, n)); 148 return os_write_file(fd, buf, n);
149} 149}
150 150
151int generic_window_size(int fd, void *unused, unsigned short *rows_out, 151int generic_window_size(int fd, void *unused, unsigned short *rows_out,
@@ -156,14 +156,14 @@ int generic_window_size(int fd, void *unused, unsigned short *rows_out,
156 156
157 ret = os_window_size(fd, &rows, &cols); 157 ret = os_window_size(fd, &rows, &cols);
158 if(ret < 0) 158 if(ret < 0)
159 return(ret); 159 return ret;
160 160
161 ret = ((*rows_out != rows) || (*cols_out != cols)); 161 ret = ((*rows_out != rows) || (*cols_out != cols));
162 162
163 *rows_out = rows; 163 *rows_out = rows;
164 *cols_out = cols; 164 *cols_out = cols;
165 165
166 return(ret); 166 return ret;
167} 167}
168 168
169void generic_free(void *data) 169void generic_free(void *data)
@@ -186,25 +186,29 @@ static void tty_receive_char(struct tty_struct *tty, char ch)
186 } 186 }
187 } 187 }
188 188
189 if((tty->flip.flag_buf_ptr == NULL) || 189 if((tty->flip.flag_buf_ptr == NULL) ||
190 (tty->flip.char_buf_ptr == NULL)) 190 (tty->flip.char_buf_ptr == NULL))
191 return; 191 return;
192 tty_insert_flip_char(tty, ch, TTY_NORMAL); 192 tty_insert_flip_char(tty, ch, TTY_NORMAL);
193} 193}
194 194
195static int open_one_chan(struct chan *chan, int input, int output, int primary) 195static int open_one_chan(struct chan *chan)
196{ 196{
197 int fd; 197 int fd;
198 198
199 if(chan->opened) return(0); 199 if(chan->opened)
200 if(chan->ops->open == NULL) fd = 0; 200 return 0;
201 else fd = (*chan->ops->open)(input, output, primary, chan->data, 201
202 &chan->dev); 202 if(chan->ops->open == NULL)
203 if(fd < 0) return(fd); 203 fd = 0;
204 else fd = (*chan->ops->open)(chan->input, chan->output, chan->primary,
205 chan->data, &chan->dev);
206 if(fd < 0)
207 return fd;
204 chan->fd = fd; 208 chan->fd = fd;
205 209
206 chan->opened = 1; 210 chan->opened = 1;
207 return(0); 211 return 0;
208} 212}
209 213
210int open_chan(struct list_head *chans) 214int open_chan(struct list_head *chans)
@@ -215,11 +219,11 @@ int open_chan(struct list_head *chans)
215 219
216 list_for_each(ele, chans){ 220 list_for_each(ele, chans){
217 chan = list_entry(ele, struct chan, list); 221 chan = list_entry(ele, struct chan, list);
218 ret = open_one_chan(chan, chan->input, chan->output, 222 ret = open_one_chan(chan);
219 chan->primary); 223 if(chan->primary)
220 if(chan->primary) err = ret; 224 err = ret;
221 } 225 }
222 return(err); 226 return err;
223} 227}
224 228
225void chan_enable_winch(struct list_head *chans, struct tty_struct *tty) 229void chan_enable_winch(struct list_head *chans, struct tty_struct *tty)
@@ -267,7 +271,7 @@ void close_chan(struct list_head *chans)
267 } 271 }
268} 272}
269 273
270int write_chan(struct list_head *chans, const char *buf, int len, 274int write_chan(struct list_head *chans, const char *buf, int len,
271 int write_irq) 275 int write_irq)
272{ 276{
273 struct list_head *ele; 277 struct list_head *ele;
@@ -285,7 +289,7 @@ int write_chan(struct list_head *chans, const char *buf, int len,
285 reactivate_fd(chan->fd, write_irq); 289 reactivate_fd(chan->fd, write_irq);
286 } 290 }
287 } 291 }
288 return(ret); 292 return ret;
289} 293}
290 294
291int console_write_chan(struct list_head *chans, const char *buf, int len) 295int console_write_chan(struct list_head *chans, const char *buf, int len)
@@ -301,10 +305,11 @@ int console_write_chan(struct list_head *chans, const char *buf, int len)
301 n = chan->ops->console_write(chan->fd, buf, len); 305 n = chan->ops->console_write(chan->fd, buf, len);
302 if(chan->primary) ret = n; 306 if(chan->primary) ret = n;
303 } 307 }
304 return(ret); 308 return ret;
305} 309}
306 310
307int console_open_chan(struct line *line, struct console *co, struct chan_opts *opts) 311int console_open_chan(struct line *line, struct console *co,
312 struct chan_opts *opts)
308{ 313{
309 if (!list_empty(&line->chan_list)) 314 if (!list_empty(&line->chan_list))
310 return 0; 315 return 0;
@@ -327,12 +332,13 @@ int chan_window_size(struct list_head *chans, unsigned short *rows_out,
327 list_for_each(ele, chans){ 332 list_for_each(ele, chans){
328 chan = list_entry(ele, struct chan, list); 333 chan = list_entry(ele, struct chan, list);
329 if(chan->primary){ 334 if(chan->primary){
330 if(chan->ops->window_size == NULL) return(0); 335 if(chan->ops->window_size == NULL)
331 return(chan->ops->window_size(chan->fd, chan->data, 336 return 0;
332 rows_out, cols_out)); 337 return chan->ops->window_size(chan->fd, chan->data,
338 rows_out, cols_out);
333 } 339 }
334 } 340 }
335 return(0); 341 return 0;
336} 342}
337 343
338void free_one_chan(struct chan *chan) 344void free_one_chan(struct chan *chan)
@@ -363,23 +369,23 @@ static int one_chan_config_string(struct chan *chan, char *str, int size,
363 369
364 if(chan == NULL){ 370 if(chan == NULL){
365 CONFIG_CHUNK(str, size, n, "none", 1); 371 CONFIG_CHUNK(str, size, n, "none", 1);
366 return(n); 372 return n;
367 } 373 }
368 374
369 CONFIG_CHUNK(str, size, n, chan->ops->type, 0); 375 CONFIG_CHUNK(str, size, n, chan->ops->type, 0);
370 376
371 if(chan->dev == NULL){ 377 if(chan->dev == NULL){
372 CONFIG_CHUNK(str, size, n, "", 1); 378 CONFIG_CHUNK(str, size, n, "", 1);
373 return(n); 379 return n;
374 } 380 }
375 381
376 CONFIG_CHUNK(str, size, n, ":", 0); 382 CONFIG_CHUNK(str, size, n, ":", 0);
377 CONFIG_CHUNK(str, size, n, chan->dev, 0); 383 CONFIG_CHUNK(str, size, n, chan->dev, 0);
378 384
379 return(n); 385 return n;
380} 386}
381 387
382static int chan_pair_config_string(struct chan *in, struct chan *out, 388static int chan_pair_config_string(struct chan *in, struct chan *out,
383 char *str, int size, char **error_out) 389 char *str, int size, char **error_out)
384{ 390{
385 int n; 391 int n;
@@ -390,7 +396,7 @@ static int chan_pair_config_string(struct chan *in, struct chan *out,
390 396
391 if(in == out){ 397 if(in == out){
392 CONFIG_CHUNK(str, size, n, "", 1); 398 CONFIG_CHUNK(str, size, n, "", 1);
393 return(n); 399 return n;
394 } 400 }
395 401
396 CONFIG_CHUNK(str, size, n, ",", 1); 402 CONFIG_CHUNK(str, size, n, ",", 1);
@@ -399,10 +405,10 @@ static int chan_pair_config_string(struct chan *in, struct chan *out,
399 size -= n; 405 size -= n;
400 CONFIG_CHUNK(str, size, n, "", 1); 406 CONFIG_CHUNK(str, size, n, "", 1);
401 407
402 return(n); 408 return n;
403} 409}
404 410
405int chan_config_string(struct list_head *chans, char *str, int size, 411int chan_config_string(struct list_head *chans, char *str, int size,
406 char **error_out) 412 char **error_out)
407{ 413{
408 struct list_head *ele; 414 struct list_head *ele;
@@ -418,7 +424,7 @@ int chan_config_string(struct list_head *chans, char *str, int size,
418 out = chan; 424 out = chan;
419 } 425 }
420 426
421 return(chan_pair_config_string(in, out, str, size, error_out)); 427 return chan_pair_config_string(in, out, str, size, error_out);
422} 428}
423 429
424struct chan_type { 430struct chan_type {
@@ -462,7 +468,7 @@ struct chan_type chan_table[] = {
462#endif 468#endif
463}; 469};
464 470
465static struct chan *parse_chan(char *str, int pri, int device, 471static struct chan *parse_chan(char *str, int pri, int device,
466 struct chan_opts *opts) 472 struct chan_opts *opts)
467{ 473{
468 struct chan_type *entry; 474 struct chan_type *entry;
@@ -484,14 +490,17 @@ static struct chan *parse_chan(char *str, int pri, int device,
484 if(ops == NULL){ 490 if(ops == NULL){
485 my_printf("parse_chan couldn't parse \"%s\"\n", 491 my_printf("parse_chan couldn't parse \"%s\"\n",
486 str); 492 str);
487 return(NULL); 493 return NULL;
488 } 494 }
489 if(ops->init == NULL) return(NULL); 495 if(ops->init == NULL)
496 return NULL;
490 data = (*ops->init)(str, device, opts); 497 data = (*ops->init)(str, device, opts);
491 if(data == NULL) return(NULL); 498 if(data == NULL)
499 return NULL;
492 500
493 chan = kmalloc(sizeof(*chan), GFP_ATOMIC); 501 chan = kmalloc(sizeof(*chan), GFP_ATOMIC);
494 if(chan == NULL) return(NULL); 502 if(chan == NULL)
503 return NULL;
495 *chan = ((struct chan) { .list = LIST_HEAD_INIT(chan->list), 504 *chan = ((struct chan) { .list = LIST_HEAD_INIT(chan->list),
496 .primary = 1, 505 .primary = 1,
497 .input = 0, 506 .input = 0,
@@ -501,7 +510,7 @@ static struct chan *parse_chan(char *str, int pri, int device,
501 .pri = pri, 510 .pri = pri,
502 .ops = ops, 511 .ops = ops,
503 .data = data }); 512 .data = data });
504 return(chan); 513 return chan;
505} 514}
506 515
507int parse_chan_pair(char *str, struct list_head *chans, int pri, int device, 516int parse_chan_pair(char *str, struct list_head *chans, int pri, int device,
@@ -512,7 +521,8 @@ int parse_chan_pair(char *str, struct list_head *chans, int pri, int device,
512 521
513 if(!list_empty(chans)){ 522 if(!list_empty(chans)){
514 chan = list_entry(chans->next, struct chan, list); 523 chan = list_entry(chans->next, struct chan, list);
515 if(chan->pri >= pri) return(0); 524 if(chan->pri >= pri)
525 return 0;
516 free_chan(chans); 526 free_chan(chans);
517 INIT_LIST_HEAD(chans); 527 INIT_LIST_HEAD(chans);
518 } 528 }
@@ -523,23 +533,29 @@ int parse_chan_pair(char *str, struct list_head *chans, int pri, int device,
523 *out = '\0'; 533 *out = '\0';
524 out++; 534 out++;
525 new = parse_chan(in, pri, device, opts); 535 new = parse_chan(in, pri, device, opts);
526 if(new == NULL) return(-1); 536 if(new == NULL)
537 return -1;
538
527 new->input = 1; 539 new->input = 1;
528 list_add(&new->list, chans); 540 list_add(&new->list, chans);
529 541
530 new = parse_chan(out, pri, device, opts); 542 new = parse_chan(out, pri, device, opts);
531 if(new == NULL) return(-1); 543 if(new == NULL)
544 return -1;
545
532 list_add(&new->list, chans); 546 list_add(&new->list, chans);
533 new->output = 1; 547 new->output = 1;
534 } 548 }
535 else { 549 else {
536 new = parse_chan(str, pri, device, opts); 550 new = parse_chan(str, pri, device, opts);
537 if(new == NULL) return(-1); 551 if(new == NULL)
552 return -1;
553
538 list_add(&new->list, chans); 554 list_add(&new->list, chans);
539 new->input = 1; 555 new->input = 1;
540 new->output = 1; 556 new->output = 1;
541 } 557 }
542 return(0); 558 return 0;
543} 559}
544 560
545int chan_out_fd(struct list_head *chans) 561int chan_out_fd(struct list_head *chans)
@@ -550,9 +566,9 @@ int chan_out_fd(struct list_head *chans)
550 list_for_each(ele, chans){ 566 list_for_each(ele, chans){
551 chan = list_entry(ele, struct chan, list); 567 chan = list_entry(ele, struct chan, list);
552 if(chan->primary && chan->output) 568 if(chan->primary && chan->output)
553 return(chan->fd); 569 return chan->fd;
554 } 570 }
555 return(-1); 571 return -1;
556} 572}
557 573
558void chan_interrupt(struct list_head *chans, struct work_struct *task, 574void chan_interrupt(struct list_head *chans, struct work_struct *task,
@@ -567,7 +583,7 @@ void chan_interrupt(struct list_head *chans, struct work_struct *task,
567 chan = list_entry(ele, struct chan, list); 583 chan = list_entry(ele, struct chan, list);
568 if(!chan->input || (chan->ops->read == NULL)) continue; 584 if(!chan->input || (chan->ops->read == NULL)) continue;
569 do { 585 do {
570 if((tty != NULL) && 586 if((tty != NULL) &&
571 (tty->flip.count >= TTY_FLIPBUF_SIZE)){ 587 (tty->flip.count >= TTY_FLIPBUF_SIZE)){
572 schedule_work(task); 588 schedule_work(task);
573 goto out; 589 goto out;
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index c31fc541e210..2ee00cbe8f9a 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -124,7 +124,8 @@ static int buffer_data(struct line *line, const char *buf, int len)
124 if (len < end){ 124 if (len < end){
125 memcpy(line->tail, buf, len); 125 memcpy(line->tail, buf, len);
126 line->tail += len; 126 line->tail += len;
127 } else { 127 }
128 else {
128 /* The circular buffer is wrapping */ 129 /* The circular buffer is wrapping */
129 memcpy(line->tail, buf, end); 130 memcpy(line->tail, buf, end);
130 buf += end; 131 buf += end;
@@ -170,7 +171,7 @@ static int flush_buffer(struct line *line)
170 } 171 }
171 172
172 count = line->tail - line->head; 173 count = line->tail - line->head;
173 n = write_chan(&line->chan_list, line->head, count, 174 n = write_chan(&line->chan_list, line->head, count,
174 line->driver->write_irq); 175 line->driver->write_irq);
175 176
176 if(n < 0) 177 if(n < 0)
@@ -227,7 +228,7 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
227 if (err <= 0 && (err != -EAGAIN || !ret)) 228 if (err <= 0 && (err != -EAGAIN || !ret))
228 ret = err; 229 ret = err;
229 } else { 230 } else {
230 n = write_chan(&line->chan_list, buf, len, 231 n = write_chan(&line->chan_list, buf, len,
231 line->driver->write_irq); 232 line->driver->write_irq);
232 if (n < 0) { 233 if (n < 0) {
233 ret = n; 234 ret = n;
@@ -384,13 +385,13 @@ int line_setup_irq(int fd, int input, int output, struct tty_struct *tty)
384 385
385 if (input) 386 if (input)
386 err = um_request_irq(driver->read_irq, fd, IRQ_READ, 387 err = um_request_irq(driver->read_irq, fd, IRQ_READ,
387 line_interrupt, flags, 388 line_interrupt, flags,
388 driver->read_irq_name, tty); 389 driver->read_irq_name, tty);
389 if (err) 390 if (err)
390 return err; 391 return err;
391 if (output) 392 if (output)
392 err = um_request_irq(driver->write_irq, fd, IRQ_WRITE, 393 err = um_request_irq(driver->write_irq, fd, IRQ_WRITE,
393 line_write_interrupt, flags, 394 line_write_interrupt, flags,
394 driver->write_irq_name, tty); 395 driver->write_irq_name, tty);
395 line->have_irq = 1; 396 line->have_irq = 1;
396 return err; 397 return err;
@@ -512,10 +513,11 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
512 /* We said con=/ssl= instead of con#=, so we are configuring all 513 /* We said con=/ssl= instead of con#=, so we are configuring all
513 * consoles at once.*/ 514 * consoles at once.*/
514 n = -1; 515 n = -1;
515 } else { 516 }
517 else {
516 n = simple_strtoul(init, &end, 0); 518 n = simple_strtoul(init, &end, 0);
517 if(*end != '='){ 519 if(*end != '='){
518 printk(KERN_ERR "line_setup failed to parse \"%s\"\n", 520 printk(KERN_ERR "line_setup failed to parse \"%s\"\n",
519 init); 521 init);
520 return 0; 522 return 0;
521 } 523 }
@@ -527,7 +529,8 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
527 printk("line_setup - %d out of range ((0 ... %d) allowed)\n", 529 printk("line_setup - %d out of range ((0 ... %d) allowed)\n",
528 n, num - 1); 530 n, num - 1);
529 return 0; 531 return 0;
530 } else if (n >= 0){ 532 }
533 else if (n >= 0){
531 if (lines[n].count > 0) { 534 if (lines[n].count > 0) {
532 printk("line_setup - device %d is open\n", n); 535 printk("line_setup - device %d is open\n", n);
533 return 0; 536 return 0;
@@ -541,11 +544,13 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
541 lines[n].valid = 1; 544 lines[n].valid = 1;
542 } 545 }
543 } 546 }
544 } else if(!all_allowed){ 547 }
548 else if(!all_allowed){
545 printk("line_setup - can't configure all devices from " 549 printk("line_setup - can't configure all devices from "
546 "mconsole\n"); 550 "mconsole\n");
547 return 0; 551 return 0;
548 } else { 552 }
553 else {
549 for(i = 0; i < num; i++){ 554 for(i = 0; i < num; i++){
550 if(lines[i].init_pri <= INIT_ALL){ 555 if(lines[i].init_pri <= INIT_ALL){
551 lines[i].init_pri = INIT_ALL; 556 lines[i].init_pri = INIT_ALL;
@@ -627,7 +632,7 @@ int line_remove(struct line *lines, unsigned int num, int n)
627} 632}
628 633
629struct tty_driver *line_register_devfs(struct lines *set, 634struct tty_driver *line_register_devfs(struct lines *set,
630 struct line_driver *line_driver, 635 struct line_driver *line_driver,
631 struct tty_operations *ops, struct line *lines, 636 struct tty_operations *ops, struct line *lines,
632 int nlines) 637 int nlines)
633{ 638{
@@ -656,7 +661,7 @@ struct tty_driver *line_register_devfs(struct lines *set,
656 } 661 }
657 662
658 for(i = 0; i < nlines; i++){ 663 for(i = 0; i < nlines; i++){
659 if(!lines[i].valid) 664 if(!lines[i].valid)
660 tty_unregister_device(driver, i); 665 tty_unregister_device(driver, i);
661 } 666 }
662 667
@@ -677,11 +682,12 @@ void lines_init(struct line *lines, int nlines)
677 line = &lines[i]; 682 line = &lines[i];
678 INIT_LIST_HEAD(&line->chan_list); 683 INIT_LIST_HEAD(&line->chan_list);
679 spin_lock_init(&line->lock); 684 spin_lock_init(&line->lock);
680 if(line->init_str != NULL){ 685 if(line->init_str == NULL)
681 line->init_str = kstrdup(line->init_str, GFP_KERNEL); 686 continue;
682 if(line->init_str == NULL) 687
683 printk("lines_init - kstrdup returned NULL\n"); 688 line->init_str = kstrdup(line->init_str, GFP_KERNEL);
684 } 689 if(line->init_str == NULL)
690 printk("lines_init - kstrdup returned NULL\n");
685 } 691 }
686} 692}
687 693
@@ -717,8 +723,7 @@ irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused)
717 tty = winch->tty; 723 tty = winch->tty;
718 if (tty != NULL) { 724 if (tty != NULL) {
719 line = tty->driver_data; 725 line = tty->driver_data;
720 chan_window_size(&line->chan_list, 726 chan_window_size(&line->chan_list, &tty->winsize.ws_row,
721 &tty->winsize.ws_row,
722 &tty->winsize.ws_col); 727 &tty->winsize.ws_col);
723 kill_pg(tty->pgrp, SIGWINCH, 1); 728 kill_pg(tty->pgrp, SIGWINCH, 1);
724 } 729 }
@@ -749,7 +754,7 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty)
749 spin_unlock(&winch_handler_lock); 754 spin_unlock(&winch_handler_lock);
750 755
751 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, 756 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
752 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM, 757 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM,
753 "winch", winch) < 0) 758 "winch", winch) < 0)
754 printk("register_winch_irq - failed to register IRQ\n"); 759 printk("register_winch_irq - failed to register IRQ\n");
755} 760}
@@ -800,7 +805,7 @@ static void winch_cleanup(void)
800 deactivate_fd(winch->fd, WINCH_IRQ); 805 deactivate_fd(winch->fd, WINCH_IRQ);
801 os_close_file(winch->fd); 806 os_close_file(winch->fd);
802 } 807 }
803 if(winch->pid != -1) 808 if(winch->pid != -1)
804 os_kill_process(winch->pid, 1); 809 os_kill_process(winch->pid, 1);
805 } 810 }
806} 811}
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index b36786410453..355866af5e0b 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -34,7 +34,7 @@
34#include "irq_kern.h" 34#include "irq_kern.h"
35#include "choose-mode.h" 35#include "choose-mode.h"
36 36
37static int do_unlink_socket(struct notifier_block *notifier, 37static int do_unlink_socket(struct notifier_block *notifier,
38 unsigned long what, void *data) 38 unsigned long what, void *data)
39{ 39{
40 return(mconsole_unlink_socket()); 40 return(mconsole_unlink_socket());
@@ -46,7 +46,7 @@ static struct notifier_block reboot_notifier = {
46 .priority = 0, 46 .priority = 0,
47}; 47};
48 48
49/* Safe without explicit locking for now. Tasklets provide their own 49/* Safe without explicit locking for now. Tasklets provide their own
50 * locking, and the interrupt handler is safe because it can't interrupt 50 * locking, and the interrupt handler is safe because it can't interrupt
51 * itself and it can only happen on CPU 0. 51 * itself and it can only happen on CPU 0.
52 */ 52 */
@@ -60,7 +60,7 @@ static void mc_work_proc(void *unused)
60 60
61 while(!list_empty(&mc_requests)){ 61 while(!list_empty(&mc_requests)){
62 local_save_flags(flags); 62 local_save_flags(flags);
63 req = list_entry(mc_requests.next, struct mconsole_entry, 63 req = list_entry(mc_requests.next, struct mconsole_entry,
64 list); 64 list);
65 list_del(&req->list); 65 list_del(&req->list);
66 local_irq_restore(flags); 66 local_irq_restore(flags);
@@ -103,8 +103,8 @@ void mconsole_version(struct mc_request *req)
103{ 103{
104 char version[256]; 104 char version[256];
105 105
106 sprintf(version, "%s %s %s %s %s", system_utsname.sysname, 106 sprintf(version, "%s %s %s %s %s", system_utsname.sysname,
107 system_utsname.nodename, system_utsname.release, 107 system_utsname.nodename, system_utsname.release,
108 system_utsname.version, system_utsname.machine); 108 system_utsname.version, system_utsname.machine);
109 mconsole_reply(req, version, 0, 0); 109 mconsole_reply(req, version, 0, 0);
110} 110}
@@ -348,7 +348,7 @@ static struct mc_device *mconsole_find_dev(char *name)
348 348
349#define CONFIG_BUF_SIZE 64 349#define CONFIG_BUF_SIZE 64
350 350
351static void mconsole_get_config(int (*get_config)(char *, char *, int, 351static void mconsole_get_config(int (*get_config)(char *, char *, int,
352 char **), 352 char **),
353 struct mc_request *req, char *name) 353 struct mc_request *req, char *name)
354{ 354{
@@ -389,7 +389,6 @@ static void mconsole_get_config(int (*get_config)(char *, char *, int,
389 out: 389 out:
390 if(buf != default_buf) 390 if(buf != default_buf)
391 kfree(buf); 391 kfree(buf);
392
393} 392}
394 393
395void mconsole_config(struct mc_request *req) 394void mconsole_config(struct mc_request *req)
@@ -420,7 +419,7 @@ void mconsole_config(struct mc_request *req)
420 419
421void mconsole_remove(struct mc_request *req) 420void mconsole_remove(struct mc_request *req)
422{ 421{
423 struct mc_device *dev; 422 struct mc_device *dev;
424 char *ptr = req->request.data, *err_msg = ""; 423 char *ptr = req->request.data, *err_msg = "";
425 char error[256]; 424 char error[256];
426 int err, start, end, n; 425 int err, start, end, n;
@@ -534,7 +533,7 @@ void mconsole_stack(struct mc_request *req)
534/* Changed by mconsole_setup, which is __setup, and called before SMP is 533/* Changed by mconsole_setup, which is __setup, and called before SMP is
535 * active. 534 * active.
536 */ 535 */
537static char *notify_socket = NULL; 536static char *notify_socket = NULL;
538 537
539int mconsole_init(void) 538int mconsole_init(void)
540{ 539{
@@ -566,13 +565,13 @@ int mconsole_init(void)
566 notify_socket = kstrdup(notify_socket, GFP_KERNEL); 565 notify_socket = kstrdup(notify_socket, GFP_KERNEL);
567 if(notify_socket != NULL) 566 if(notify_socket != NULL)
568 mconsole_notify(notify_socket, MCONSOLE_SOCKET, 567 mconsole_notify(notify_socket, MCONSOLE_SOCKET,
569 mconsole_socket_name, 568 mconsole_socket_name,
570 strlen(mconsole_socket_name) + 1); 569 strlen(mconsole_socket_name) + 1);
571 else printk(KERN_ERR "mconsole_setup failed to strdup " 570 else printk(KERN_ERR "mconsole_setup failed to strdup "
572 "string\n"); 571 "string\n");
573 } 572 }
574 573
575 printk("mconsole (version %d) initialized on %s\n", 574 printk("mconsole (version %d) initialized on %s\n",
576 MCONSOLE_VERSION, mconsole_socket_name); 575 MCONSOLE_VERSION, mconsole_socket_name);
577 return(0); 576 return(0);
578} 577}
@@ -585,7 +584,7 @@ static int write_proc_mconsole(struct file *file, const char __user *buffer,
585 char *buf; 584 char *buf;
586 585
587 buf = kmalloc(count + 1, GFP_KERNEL); 586 buf = kmalloc(count + 1, GFP_KERNEL);
588 if(buf == NULL) 587 if(buf == NULL)
589 return(-ENOMEM); 588 return(-ENOMEM);
590 589
591 if(copy_from_user(buf, buffer, count)){ 590 if(copy_from_user(buf, buffer, count)){
@@ -661,7 +660,7 @@ static int notify_panic(struct notifier_block *self, unsigned long unused1,
661 660
662 if(notify_socket == NULL) return(0); 661 if(notify_socket == NULL) return(0);
663 662
664 mconsole_notify(notify_socket, MCONSOLE_PANIC, message, 663 mconsole_notify(notify_socket, MCONSOLE_PANIC, message,
665 strlen(message) + 1); 664 strlen(message) + 1);
666 return(0); 665 return(0);
667} 666}
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index 62e04ecfada8..95a3eaa7163c 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -69,7 +69,7 @@ static struct line_driver driver = {
69 .name = "ssl", 69 .name = "ssl",
70 .config = ssl_config, 70 .config = ssl_config,
71 .get_config = ssl_get_config, 71 .get_config = ssl_get_config,
72 .id = line_id, 72 .id = line_id,
73 .remove = ssl_remove, 73 .remove = ssl_remove,
74 }, 74 },
75}; 75};
@@ -84,21 +84,21 @@ static struct lines lines = LINES_INIT(NR_PORTS);
84 84
85static int ssl_config(char *str) 85static int ssl_config(char *str)
86{ 86{
87 return(line_config(serial_lines, 87 return line_config(serial_lines,
88 sizeof(serial_lines)/sizeof(serial_lines[0]), str)); 88 sizeof(serial_lines)/sizeof(serial_lines[0]), str);
89} 89}
90 90
91static int ssl_get_config(char *dev, char *str, int size, char **error_out) 91static int ssl_get_config(char *dev, char *str, int size, char **error_out)
92{ 92{
93 return(line_get_config(dev, serial_lines, 93 return line_get_config(dev, serial_lines,
94 sizeof(serial_lines)/sizeof(serial_lines[0]), 94 sizeof(serial_lines)/sizeof(serial_lines[0]),
95 str, size, error_out)); 95 str, size, error_out);
96} 96}
97 97
98static int ssl_remove(int n) 98static int ssl_remove(int n)
99{ 99{
100 return line_remove(serial_lines, 100 return line_remove(serial_lines,
101 sizeof(serial_lines)/sizeof(serial_lines[0]), n); 101 sizeof(serial_lines)/sizeof(serial_lines[0]), n);
102} 102}
103 103
104int ssl_open(struct tty_struct *tty, struct file *filp) 104int ssl_open(struct tty_struct *tty, struct file *filp)
@@ -183,7 +183,7 @@ static int ssl_console_setup(struct console *co, char *options)
183{ 183{
184 struct line *line = &serial_lines[co->index]; 184 struct line *line = &serial_lines[co->index];
185 185
186 return console_open_chan(line,co,&opts); 186 return console_open_chan(line, co, &opts);
187} 187}
188 188
189static struct console ssl_cons = { 189static struct console ssl_cons = {
@@ -199,10 +199,11 @@ int ssl_init(void)
199{ 199{
200 char *new_title; 200 char *new_title;
201 201
202 printk(KERN_INFO "Initializing software serial port version %d\n", 202 printk(KERN_INFO "Initializing software serial port version %d\n",
203 ssl_version); 203 ssl_version);
204 ssl_driver = line_register_devfs(&lines, &driver, &ssl_ops, 204 ssl_driver = line_register_devfs(&lines, &driver, &ssl_ops,
205 serial_lines, ARRAY_SIZE(serial_lines)); 205 serial_lines,
206 ARRAY_SIZE(serial_lines));
206 207
207 lines_init(serial_lines, sizeof(serial_lines)/sizeof(serial_lines[0])); 208 lines_init(serial_lines, sizeof(serial_lines)/sizeof(serial_lines[0]));
208 209
@@ -212,7 +213,7 @@ int ssl_init(void)
212 213
213 ssl_init_done = 1; 214 ssl_init_done = 1;
214 register_console(&ssl_cons); 215 register_console(&ssl_cons);
215 return(0); 216 return 0;
216} 217}
217late_initcall(ssl_init); 218late_initcall(ssl_init);
218 219
@@ -227,9 +228,9 @@ __uml_exitcall(ssl_exit);
227 228
228static int ssl_chan_setup(char *str) 229static int ssl_chan_setup(char *str)
229{ 230{
230 return(line_setup(serial_lines, 231 return line_setup(serial_lines,
231 sizeof(serial_lines)/sizeof(serial_lines[0]), 232 sizeof(serial_lines)/sizeof(serial_lines[0]),
232 str, 1)); 233 str, 1);
233} 234}
234 235
235__setup("ssl", ssl_chan_setup); 236__setup("ssl", ssl_chan_setup);
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 005aa6333b6e..8f3b168a4b6a 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,23 +86,23 @@ 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 */
88struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver), 88struct 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
92static int con_config(char *str) 92static int con_config(char *str)
93{ 93{
94 return(line_config(vts, sizeof(vts)/sizeof(vts[0]), str)); 94 return line_config(vts, sizeof(vts)/sizeof(vts[0]), str);
95} 95}
96 96
97static int con_get_config(char *dev, char *str, int size, char **error_out) 97static 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, sizeof(vts)/sizeof(vts[0]), str,
100 size, error_out)); 100 size, error_out);
101} 101}
102 102
103static int con_remove(int n) 103static int con_remove(int n)
104{ 104{
105 return line_remove(vts, sizeof(vts)/sizeof(vts[0]), n); 105 return line_remove(vts, sizeof(vts)/sizeof(vts[0]), n);
106} 106}
107 107
108static int con_open(struct tty_struct *tty, struct file *filp) 108static int con_open(struct tty_struct *tty, struct file *filp)
@@ -117,7 +117,7 @@ static struct tty_operations console_ops = {
117 .close = line_close, 117 .close = line_close,
118 .write = line_write, 118 .write = line_write,
119 .put_char = line_put_char, 119 .put_char = line_put_char,
120 .write_room = line_write_room, 120 .write_room = line_write_room,
121 .chars_in_buffer = line_chars_in_buffer, 121 .chars_in_buffer = line_chars_in_buffer,
122 .flush_buffer = line_flush_buffer, 122 .flush_buffer = line_flush_buffer,
123 .flush_chars = line_flush_chars, 123 .flush_chars = line_flush_chars,
@@ -126,7 +126,7 @@ static struct tty_operations console_ops = {
126}; 126};
127 127
128static void uml_console_write(struct console *console, const char *string, 128static void uml_console_write(struct console *console, const char *string,
129 unsigned len) 129 unsigned len)
130{ 130{
131 struct line *line = &vts[console->index]; 131 struct line *line = &vts[console->index];
132 unsigned long flags; 132 unsigned long flags;
@@ -146,7 +146,7 @@ static int uml_console_setup(struct console *co, char *options)
146{ 146{
147 struct line *line = &vts[co->index]; 147 struct line *line = &vts[co->index];
148 148
149 return console_open_chan(line,co,&opts); 149 return console_open_chan(line, co, &opts);
150} 150}
151 151
152static struct console stdiocons = { 152static struct console stdiocons = {
@@ -156,7 +156,7 @@ static struct console stdiocons = {
156 .setup = uml_console_setup, 156 .setup = uml_console_setup,
157 .flags = CON_PRINTBUFFER, 157 .flags = CON_PRINTBUFFER,
158 .index = -1, 158 .index = -1,
159 .data = &vts, 159 .data = &vts,
160}; 160};
161 161
162int stdio_init(void) 162int stdio_init(void)
@@ -166,7 +166,7 @@ int stdio_init(void)
166 console_driver = line_register_devfs(&console_lines, &driver, 166 console_driver = line_register_devfs(&console_lines, &driver,
167 &console_ops, vts, 167 &console_ops, vts,
168 ARRAY_SIZE(vts)); 168 ARRAY_SIZE(vts));
169 if (NULL == console_driver) 169 if (console_driver == NULL)
170 return -1; 170 return -1;
171 printk(KERN_INFO "Initialized stdio console driver\n"); 171 printk(KERN_INFO "Initialized stdio console driver\n");
172 172
@@ -178,7 +178,7 @@ int stdio_init(void)
178 178
179 con_init_done = 1; 179 con_init_done = 1;
180 register_console(&stdiocons); 180 register_console(&stdiocons);
181 return(0); 181 return 0;
182} 182}
183late_initcall(stdio_init); 183late_initcall(stdio_init);
184 184
@@ -192,7 +192,7 @@ __uml_exitcall(console_exit);
192 192
193static int console_chan_setup(char *str) 193static int console_chan_setup(char *str)
194{ 194{
195 return(line_setup(vts, sizeof(vts)/sizeof(vts[0]), str, 1)); 195 return line_setup(vts, sizeof(vts)/sizeof(vts[0]), str, 1);
196} 196}
197__setup("con", console_chan_setup); 197__setup("con", console_chan_setup);
198__channel_help(console_chan_setup, "con"); 198__channel_help(console_chan_setup, "con");