um: switch line_config() to setup_one_line()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Al Viro 2011-09-08 20:44:06 -04:00 committed by Richard Weinberger
parent da645f3be9
commit fe9a6b0029

View File

@ -572,22 +572,32 @@ int line_config(struct line *lines, unsigned int num, char *str,
{ {
struct line *line; struct line *line;
char *new; char *new;
int n; char *end;
int n, err;
if (*str == '=') { if (*str == '=') {
*error_out = "Can't configure all devices from mconsole"; *error_out = "Can't configure all devices from mconsole";
return -EINVAL; return -EINVAL;
} }
new = kstrdup(str, GFP_KERNEL); n = simple_strtoul(str, &end, 0);
if (*end++ != '=') {
*error_out = "Couldn't parse device number";
return -EINVAL;
}
if (n >= num) {
*error_out = "Device number out of range";
return -EINVAL;
}
new = kstrdup(end, GFP_KERNEL);
if (new == NULL) { if (new == NULL) {
*error_out = "Failed to allocate memory"; *error_out = "Failed to allocate memory";
return -ENOMEM; return -ENOMEM;
} }
n = line_setup(lines, num, new, error_out); err = setup_one_line(lines, n, new, INIT_ONE, error_out);
if (n < 0) if (err)
return n; return err;
line = &lines[n]; line = &lines[n];
return parse_chan_pair(line->init_str, line, n, opts, error_out); return parse_chan_pair(line->init_str, line, n, opts, error_out);
} }