aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/line.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-01-06 03:18:55 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:46 -0500
commit1f80171e81ed0d08dcdb6efe239d7b929aef498f (patch)
treef6f72268ddee265b46ceb698cdff6daa7cba6250 /arch/um/drivers/line.c
parent418e55d49b0ec7d2e7a033f2dd083f5b2ab7d119 (diff)
[PATCH] uml: move console configuration
This patch changes when console devices are configured in order to prepare the ground for the next patch. parse_chan_pair is now done earlier, when initcalls are run, rather than when the device is opened. When a host device disappears, the channel list is closed, but not freed. This is required by the previous change. line_config now takes the options structure as an argument, and line_open doesn't. 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/line.c')
-rw-r--r--arch/um/drivers/line.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 1352a212964..da81d22ec04 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -419,8 +419,7 @@ void line_disable(struct tty_struct *tty, int current_irq)
419 line->have_irq = 0; 419 line->have_irq = 0;
420} 420}
421 421
422int line_open(struct line *lines, struct tty_struct *tty, 422int line_open(struct line *lines, struct tty_struct *tty)
423 struct chan_opts *opts)
424{ 423{
425 struct line *line; 424 struct line *line;
426 int err = 0; 425 int err = 0;
@@ -436,13 +435,11 @@ int line_open(struct line *lines, struct tty_struct *tty,
436 err = -ENODEV; 435 err = -ENODEV;
437 goto out; 436 goto out;
438 } 437 }
439 if (list_empty(&line->chan_list)) { 438
440 err = parse_chan_pair(line->init_str, &line->chan_list, 439 err = open_chan(&line->chan_list);
441 tty->index, opts); 440 if(err)
442 if(err) goto out; 441 goto out;
443 err = open_chan(&line->chan_list); 442
444 if(err) goto out;
445 }
446 /* Here the interrupt is registered.*/ 443 /* Here the interrupt is registered.*/
447 enable_chan(&line->chan_list, tty); 444 enable_chan(&line->chan_list, tty);
448 INIT_WORK(&line->task, line_timer_cb, tty); 445 INIT_WORK(&line->task, line_timer_cb, tty);
@@ -558,8 +555,10 @@ int line_setup(struct line *lines, unsigned int num, char *init)
558 return n == -1 ? num : n; 555 return n == -1 ? num : n;
559} 556}
560 557
561int line_config(struct line *lines, unsigned int num, char *str) 558int line_config(struct line *lines, unsigned int num, char *str,
559 struct chan_opts *opts)
562{ 560{
561 struct line *line;
563 char *new; 562 char *new;
564 int n; 563 int n;
565 564
@@ -572,10 +571,14 @@ int line_config(struct line *lines, unsigned int num, char *str)
572 new = kstrdup(str, GFP_KERNEL); 571 new = kstrdup(str, GFP_KERNEL);
573 if(new == NULL){ 572 if(new == NULL){
574 printk("line_config - kstrdup failed\n"); 573 printk("line_config - kstrdup failed\n");
575 return -ENOMEM; 574 return 1;
576 } 575 }
577 n = line_setup(lines, num, new); 576 n = line_setup(lines, num, new);
578 return n < 0 ? n : 0; 577 if(n < 0)
578 return 1;
579
580 line = &lines[n];
581 return parse_chan_pair(line->init_str, &line->chan_list, n, opts);
579} 582}
580 583
581int line_get_config(char *name, struct line *lines, unsigned int num, char *str, 584int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
@@ -677,7 +680,7 @@ struct tty_driver *line_register_devfs(struct lines *set,
677static DEFINE_SPINLOCK(winch_handler_lock); 680static DEFINE_SPINLOCK(winch_handler_lock);
678static LIST_HEAD(winch_handlers); 681static LIST_HEAD(winch_handlers);
679 682
680void lines_init(struct line *lines, int nlines) 683void lines_init(struct line *lines, int nlines, struct chan_opts *opts)
681{ 684{
682 struct line *line; 685 struct line *line;
683 int i; 686 int i;
@@ -692,6 +695,11 @@ void lines_init(struct line *lines, int nlines)
692 line->init_str = kstrdup(line->init_str, GFP_KERNEL); 695 line->init_str = kstrdup(line->init_str, GFP_KERNEL);
693 if(line->init_str == NULL) 696 if(line->init_str == NULL)
694 printk("lines_init - kstrdup returned NULL\n"); 697 printk("lines_init - kstrdup returned NULL\n");
698
699 if(parse_chan_pair(line->init_str, &line->chan_list, i, opts)){
700 printk("parse_chan_pair failed for device %d\n", i);
701 line->valid = 0;
702 }
695 } 703 }
696} 704}
697 705