From 43574c1afea4f798592c03cf4d4ecea4fd0a8416 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 9 Sep 2011 17:25:00 -0400 Subject: um: get rid of the init_prio mess make line_setup() act on a separate array of conf strings + default conf, have lines array initialized explicitly by that data, bury LINE_INIT() macro from hell. Signed-off-by: Al Viro Signed-off-by: Richard Weinberger --- arch/um/drivers/ssl.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'arch/um/drivers/ssl.c') diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index 9d8c20af6f80..445288ff0650 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c @@ -71,8 +71,9 @@ static struct line_driver driver = { /* The array is initialized by line_init, at initcall time. The * elements are locked individually as needed. */ -static struct line serial_lines[NR_PORTS] = - { [0 ... NR_PORTS - 1] = LINE_INIT(CONFIG_SSL_CHAN, &driver) }; +static char *conf[NR_PORTS]; +static char *def_conf = CONFIG_SSL_CHAN; +static struct line serial_lines[NR_PORTS]; static int ssl_config(char *str, char **error_out) { @@ -186,9 +187,23 @@ static struct console ssl_cons = { static int ssl_init(void) { char *new_title; + int i; printk(KERN_INFO "Initializing software serial port version %d\n", ssl_version); + + for (i = 0; i < NR_PORTS; i++) { + char *s = conf[i]; + if (!s) + s = def_conf; + if (s && strcmp(s, "none") != 0) { + serial_lines[i].init_str = s; + serial_lines[i].valid = 1; + } + spin_lock_init(&serial_lines[i].lock); + spin_lock_init(&serial_lines[i].count_lock); + serial_lines[i].driver = &driver; + } ssl_driver = register_lines(&driver, &ssl_ops, serial_lines, ARRAY_SIZE(serial_lines)); @@ -214,14 +229,7 @@ __uml_exitcall(ssl_exit); static int ssl_chan_setup(char *str) { - char *error; - int ret; - - ret = line_setup(serial_lines, ARRAY_SIZE(serial_lines), str, &error); - if(ret < 0) - printk(KERN_ERR "Failed to set up serial line with " - "configuration string \"%s\" : %s\n", str, error); - + line_setup(conf, NR_PORTS, &def_conf, str, "serial line"); return 1; } -- cgit v1.2.1