aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/line.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers/line.c')
-rw-r--r--arch/um/drivers/line.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 015209a98815..002d4a968ae6 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -481,8 +481,8 @@ void close_lines(struct line *lines, int nlines)
481 close_chan(&lines[i].chan_list, 0); 481 close_chan(&lines[i].chan_list, 0);
482} 482}
483 483
484static int setup_one_line(struct line *lines, int n, char *init, 484int setup_one_line(struct line *lines, int n, char *init,
485 const struct chan_opts *opts, char **error_out) 485 const struct chan_opts *opts, char **error_out)
486{ 486{
487 struct line *line = &lines[n]; 487 struct line *line = &lines[n];
488 struct tty_driver *driver = line->driver->driver; 488 struct tty_driver *driver = line->driver->driver;
@@ -658,6 +658,7 @@ int register_lines(struct line_driver *line_driver,
658{ 658{
659 struct tty_driver *driver = alloc_tty_driver(nlines); 659 struct tty_driver *driver = alloc_tty_driver(nlines);
660 int err; 660 int err;
661 int i;
661 662
662 if (!driver) 663 if (!driver)
663 return -ENOMEM; 664 return -ENOMEM;
@@ -670,6 +671,13 @@ int register_lines(struct line_driver *line_driver,
670 driver->subtype = line_driver->subtype; 671 driver->subtype = line_driver->subtype;
671 driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; 672 driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
672 driver->init_termios = tty_std_termios; 673 driver->init_termios = tty_std_termios;
674
675 for (i = 0; i < nlines; i++) {
676 spin_lock_init(&lines[i].lock);
677 mutex_init(&lines[i].count_lock);
678 lines[i].driver = line_driver;
679 INIT_LIST_HEAD(&lines[i].chan_list);
680 }
673 tty_set_operations(driver, ops); 681 tty_set_operations(driver, ops);
674 682
675 err = tty_register_driver(driver); 683 err = tty_register_driver(driver);
@@ -688,25 +696,6 @@ int register_lines(struct line_driver *line_driver,
688static DEFINE_SPINLOCK(winch_handler_lock); 696static DEFINE_SPINLOCK(winch_handler_lock);
689static LIST_HEAD(winch_handlers); 697static LIST_HEAD(winch_handlers);
690 698
691void lines_init(struct line *lines, int nlines, struct chan_opts *opts)
692{
693 struct line *line;
694 char *error;
695 int i;
696
697 for(i = 0; i < nlines; i++) {
698 line = &lines[i];
699 INIT_LIST_HEAD(&line->chan_list);
700
701 if (line->init_str == NULL)
702 continue;
703
704 if (setup_one_line(lines, i, line->init_str, opts, &error))
705 printk(KERN_ERR "setup_one_line failed for "
706 "device %d : %s\n", i, error);
707 }
708}
709
710struct winch { 699struct winch {
711 struct list_head list; 700 struct list_head list;
712 int fd; 701 int fd;