mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] console: set default console_device devname
@ 2019-09-08 22:01 dgienda125
  2019-09-09  8:56 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: dgienda125 @ 2019-09-08 22:01 UTC (permalink / raw)
  To: barebox; +Cc: David Dgien

From: David Dgien <dgienda125@gmail.com>

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>
---
 common/console.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/console.c b/common/console.c
index ee17a508b..dacb6001c 100644
--- a/common/console.c
+++ b/common/console.c
@@ -324,6 +324,10 @@ int console_register(struct console_device *newcdev)
 		dev->parent = newcdev->dev;
 	platform_device_register(dev);
 
+	if (!newcdev->devname) {
+		newcdev->devname = strdup(dev_name(dev));
+	}
+
 	newcdev->open_count = 0;
 
 	/*
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-09  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-08 22:01 [PATCH] console: set default console_device devname dgienda125
2019-09-09  8:56 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox