From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from magratgarlick.emantor.de ([78.46.208.201]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hurkq-0007Wv-EV for barebox@lists.infradead.org; Tue, 06 Aug 2019 05:11:26 +0000 From: Rouven Czerwinski Date: Tue, 6 Aug 2019 07:11:01 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v3 11/16] stdio: puts and putchar static inline wrappers To: barebox@lists.infradead.org Cc: Rouven Czerwinski Add static inline wrappers for puts and putchar. This allows the usage of puts and putchar within the PBL even if the PBL_CONSOLE is disabled. Signed-off-by: Rouven Czerwinski --- include/stdio.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/stdio.h b/include/stdio.h index 7b2a42b..46e2778 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -71,23 +71,32 @@ static inline int ctrlc (void) #if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \ (defined(__PBL__) && defined(CONFIG_PBL_CONSOLE)) int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); + +static inline int puts(const char *s) +{ + return console_puts(CONSOLE_STDOUT, s); +} + +static inline void putchar(char c) +{ + console_putc(CONSOLE_STDOUT, c); +} #else static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); static inline int printf(const char *fmt, ...) { return 0; } -#endif - static inline int puts(const char *s) { - return console_puts(CONSOLE_STDOUT, s); + return 0; } static inline void putchar(char c) { - console_putc(CONSOLE_STDOUT, c); + return; } +#endif /* * FILE based functions -- git-series 0.9.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox