[U-Boot] [RFC PATCH 07/14] dm: Allow stdio registration to be dropped

Simon Glass sjg at chromium.org
Wed Sep 24 01:30:01 CEST 2014


Provide a CONFIG_DM_STDIO option to enable registering a serial device
with the stdio library. This is seldom useful in SPL, so disable it by
default when building for SPL.

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

 drivers/serial/serial-uclass.c | 8 +++++---
 include/config_defaults.h      | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 522e551..a11cc74 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -180,9 +180,11 @@ int serial_stub_tstc(struct stdio_dev *sdev)
 
 static int serial_post_probe(struct udevice *dev)
 {
-	struct stdio_dev sdev;
 	struct dm_serial_ops *ops = serial_get_ops(dev);
+#ifdef CONFIG_DM_STDIO
 	struct serial_dev_priv *upriv = dev->uclass_priv;
+	struct stdio_dev sdev;
+#endif
 	int ret;
 
 	/* Set the baud rate */
@@ -192,9 +194,9 @@ static int serial_post_probe(struct udevice *dev)
 			return ret;
 	}
 
+#ifdef CONFIG_DM_STDIO
 	if (!(gd->flags & GD_FLG_RELOC))
 		return 0;
-
 	memset(&sdev, '\0', sizeof(sdev));
 
 	strncpy(sdev.name, dev->name, sizeof(sdev.name));
@@ -205,7 +207,7 @@ static int serial_post_probe(struct udevice *dev)
 	sdev.getc = serial_stub_getc;
 	sdev.tstc = serial_stub_tstc;
 	stdio_register_dev(&sdev, &upriv->sdev);
-
+#endif
 	return 0;
 }
 
diff --git a/include/config_defaults.h b/include/config_defaults.h
index 985f055..f1b225d 100644
--- a/include/config_defaults.h
+++ b/include/config_defaults.h
@@ -22,6 +22,7 @@
 
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_DM_DEVICE_REMOVE
+#define CONFIG_DM_STDIO
 #endif
 
 #endif
-- 
2.1.0.rc2.206.gedb03e5



More information about the U-Boot mailing list