summaryrefslogtreecommitdiffstats
path: root/common/console.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-07-03 10:26:21 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2010-07-03 10:26:21 +0200
commit6d1d9e8d8b4be5645d3613522093cdcaddad5bff (patch)
treef0147f6620fc6bce6b403f9e9c006e629ae6796f /common/console.c
parent0db4be97f2ebd6cedad9c113ca49667c0b1e8d75 (diff)
parent7f5644fad10f8f7a86742dd30d2812261cd0a623 (diff)
downloadbarebox-6d1d9e8d8b4be5645d3613522093cdcaddad5bff.tar.gz
barebox-6d1d9e8d8b4be5645d3613522093cdcaddad5bff.tar.xz
Merge branch 'next'
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/common/console.c b/common/console.c
index d3d31f7898..7199d9afb8 100644
--- a/common/console.c
+++ b/common/console.c
@@ -57,26 +57,32 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
const char *val)
{
struct console_device *cdev = dev->type_data;
+ char active[4];
unsigned int flag = 0, i = 0;
+ if (!val)
+ dev_param_set_generic(dev, param, NULL);
+
if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) {
- cdev->active[i++] = 'i';
+ active[i++] = 'i';
flag |= CONSOLE_STDIN;
}
if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) {
- cdev->active[i++] = 'o';
+ active[i++] = 'o';
flag |= CONSOLE_STDOUT;
}
if (strchr(val, 'e') && cdev->f_caps & CONSOLE_STDERR) {
- cdev->active[i++] = 'e';
+ active[i++] = 'e';
flag |= CONSOLE_STDERR;
}
- cdev->active[i] = 0;
+ active[i] = 0;
cdev->f_active = flag;
+ dev_param_set_generic(dev, param, active);
+
return 0;
}
@@ -85,8 +91,12 @@ static int console_baudrate_set(struct device_d *dev, struct param_d *param,
{
struct console_device *cdev = dev->type_data;
int baudrate;
+ char baudstr[16];
unsigned char c;
+ if (!val)
+ dev_param_set_generic(dev, param, NULL);
+
baudrate = simple_strtoul(val, NULL, 10);
if (cdev->f_active) {
@@ -101,7 +111,8 @@ static int console_baudrate_set(struct device_d *dev, struct param_d *param,
} else
cdev->setbrg(cdev, baudrate);
- sprintf(cdev->baudrate_string, "%d", baudrate);
+ sprintf(baudstr, "%d", baudrate);
+ dev_param_set_generic(dev, param, baudstr);
return 0;
}
@@ -129,29 +140,20 @@ int console_register(struct console_device *newcdev)
register_device(dev);
if (newcdev->setbrg) {
- newcdev->baudrate_param.set = console_baudrate_set;
- newcdev->baudrate_param.name = "baudrate";
- sprintf(newcdev->baudrate_string, "%d",
- CONFIG_BAUDRATE);
- console_baudrate_set(dev, &newcdev->baudrate_param,
- newcdev->baudrate_string);
- newcdev->baudrate_param.value = newcdev->baudrate_string;
- dev_add_param(dev, &newcdev->baudrate_param);
+ dev_add_param(dev, "baudrate", console_baudrate_set, NULL, 0);
+ dev_set_param(dev, "baudrate", "115200");
}
- newcdev->active_param.set = console_std_set;
- newcdev->active_param.name = "active";
- newcdev->active_param.value = newcdev->active;
- dev_add_param(dev, &newcdev->active_param);
+ dev_add_param(dev, "active", console_std_set, NULL, 0);
initialized = CONSOLE_INIT_FULL;
#ifdef CONFIG_CONSOLE_ACTIVATE_ALL
- console_std_set(dev, &newcdev->active_param, "ioe");
+ dev_set_param(dev, "active", "ioe");
#endif
#ifdef CONFIG_CONSOLE_ACTIVATE_FIRST
if (list_empty(&console_list)) {
first = 1;
- console_std_set(dev, &newcdev->active_param, "ioe");
+ dev_set_param(dev, "active", "ioe");
}
#endif