mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: dgienda125@gmail.com
To: barebox@lists.infradead.org
Cc: David Dgien <dgienda125@gmail.com>
Subject: [PATCH] console: set default console_device devname
Date: Sun,  8 Sep 2019 18:01:11 -0400	[thread overview]
Message-ID: <20190908220111.694-1-dgienda125@gmail.com> (raw)

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

             reply	other threads:[~2019-09-08 22:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-08 22:01 dgienda125 [this message]
2019-09-09  8:56 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190908220111.694-1-dgienda125@gmail.com \
    --to=dgienda125@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox