From patchwork Sun Oct 7 00:07:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,1/6] serial: Implement default_serial_puts() Date: Sat, 06 Oct 2012 14:07:01 -0000 From: Marek Vasut X-Patchwork-Id: 189775 Message-Id: <1349568426-27219-2-git-send-email-marex@denx.de> To: u-boot@lists.denx.de Cc: Marek Vasut , Tom Rini U-Boot contains a lot of duplicit implementations of serial_puts() call which just pipes single characters into the port in loop. Implement function that does this behavior into common code, so others can make easy use of it. This function is called default_serial_puts() and it's sole purpose is to call putc() in loop on the whole string passed to it. Signed-off-by: Marek Vasut Cc: Marek Vasut Cc: Tom Rini --- drivers/serial/serial.c | 7 +++++++ include/serial.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 9550cbd..da41cd5 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -271,6 +271,13 @@ void serial_puts(const char *s) get_current()->puts(s); } +void default_serial_puts(const char *s) +{ + struct serial_device *dev = get_current(); + while (*s) + dev->putc(*s++); +} + #if CONFIG_POST & CONFIG_SYS_POST_UART static const int bauds[] = CONFIG_SYS_BAUDRATE_TABLE; diff --git a/include/serial.h b/include/serial.h index a8d23f5..14f863e 100644 --- a/include/serial.h +++ b/include/serial.h @@ -20,6 +20,8 @@ struct serial_device { struct serial_device *next; }; +void default_serial_puts(const char *s); + extern struct serial_device serial_smc_device; extern struct serial_device serial_scc_device; extern struct serial_device *default_serial_console(void);