summaryrefslogtreecommitdiffstats
path: root/common/console.c
diff options
context:
space:
mode:
authorDavid Dgien <dgienda125@gmail.com>2019-09-08 18:01:11 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2019-09-09 10:57:19 +0200
commitb330984ac85f9057846b20361dbf083c2d43547c (patch)
tree7b3c7dbc451e3f17be39ed6657445ea112e72b24 /common/console.c
parentcd6fe5bd7395c6d0e8bb3629a8d0e376a7984855 (diff)
downloadbarebox-b330984ac85f9057846b20361dbf083c2d43547c.tar.gz
console: set default console_device devname
Some commands (loadb/x/y) rely on console_get_by_name, which searches the list of console devices based on console_device->devname. However, some serial drivers do not set devname, meaning that their respective console_devices can never be found. During console_register, ensure that a default devname is set if one is not already explicitly set. Signed-off-by: David Dgien <dgienda125@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/console.c b/common/console.c
index 3f3a30f..d04aae5 100644
--- a/common/console.c
+++ b/common/console.c
@@ -323,6 +323,9 @@ int console_register(struct console_device *newcdev)
dev->parent = newcdev->dev;
platform_device_register(dev);
+ if (!newcdev->devname)
+ newcdev->devname = xstrdup(dev_name(dev));
+
newcdev->open_count = 0;
/*