diff mbox

[U-Boot,v2,03/37] video: Name consoles by their number

Message ID 1453430725-4641-4-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Jan. 22, 2016, 2:44 a.m. UTC
We must use the console name in the 'stdout' variable to select the one
we want. At present the name is formed from the driver name with a suffix
indicating the rotation value.

It seems better to name them sequentially since this can be controlled by
driver order. So adjust the code to use 'vidconsole' for the first,
'vidconsole1' for the second, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/video/vidconsole-uclass.c | 7 ++++++-
 include/configs/sandbox.h         | 8 ++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

Comments

Simon Glass Jan. 22, 2016, 6:37 p.m. UTC | #1
On 21 January 2016 at 19:44, Simon Glass <sjg@chromium.org> wrote:
> We must use the console name in the 'stdout' variable to select the one
> we want. At present the name is formed from the driver name with a suffix
> indicating the rotation value.
>
> It seems better to name them sequentially since this can be controlled by
> driver order. So adjust the code to use 'vidconsole' for the first,
> 'vidconsole1' for the second, etc.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  drivers/video/vidconsole-uclass.c | 7 ++++++-
>  include/configs/sandbox.h         | 8 ++++----
>  2 files changed, 10 insertions(+), 5 deletions(-)

Applied to u-boot-rockchip.
diff mbox

Patch

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index ea10189..706a189 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -161,7 +161,12 @@  static int vidconsole_post_probe(struct udevice *dev)
 	struct stdio_dev *sdev = &priv->sdev;
 	int ret;
 
-	strlcpy(sdev->name, dev->name, sizeof(sdev->name));
+	if (dev->seq) {
+		snprintf(sdev->name, sizeof(sdev->name), "vidconsole%d",
+			 dev->seq);
+	} else {
+		strcpy(sdev->name, "vidconsole");
+	}
 	sdev->flags = DEV_FLAGS_OUTPUT;
 	sdev->putc = vidconsole_putc;
 	sdev->puts = vidconsole_puts;
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 6498981..4bffd8d 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -169,12 +169,12 @@ 
 #define CONFIG_KEYBOARD
 
 #define SANDBOX_SERIAL_SETTINGS		"stdin=serial,cros-ec-keyb,usbkbd\0" \
-					"stdout=serial,lcd.vidconsole\0" \
-					"stderr=serial,lcd.vidconsole\0"
+					"stdout=serial,vidconsole\0" \
+					"stderr=serial,vidconsole\0"
 #else
 #define SANDBOX_SERIAL_SETTINGS		"stdin=serial\0" \
-					"stdout=serial,lcd.vidconsole\0" \
-					"stderr=serial,lcd.vidconsole\0"
+					"stdout=serial,vidconsole\0" \
+					"stderr=serial,vidconsole\0"
 #endif
 
 #define SANDBOX_ETH_SETTINGS		"ethaddr=00:00:11:22:33:44\0" \