[PATCH 21/27] pbl: console: Convert pr_print into a single line #define

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PBL's implementation of pr_print(), doesn't use its 'level' argument
at all, so it is identical in its behaviour to simple printf(). In
light of that drop the custom code implementing that and convert it to
be a CPP macro that is expanded into simple printf().

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 include/printk.h |  5 +++--
 pbl/console.c    | 14 --------------
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/include/printk.h b/include/printk.h
index b4ae0b321..9f1831fbe 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -34,10 +34,11 @@ static inline int dev_printf(int level, const struct device_d *dev, const char *
 }
 #endif
 
-#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
-	(defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
+#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE))
 int pr_print(int level, const char *format, ...)
 	__attribute__ ((format(__printf__, 2, 3)));
+#elif defined(__PBL__) && defined(CONFIG_PBL_CONSOLE)
+#define pr_print(level, format, arg...)	printf(format, ## arg)
 #else
 static int pr_print(int level, const char *format, ...)
 	__attribute__ ((format(__printf__, 2, 3)));
diff --git a/pbl/console.c b/pbl/console.c
index 18df1efca..78beab688 100644
--- a/pbl/console.c
+++ b/pbl/console.c
@@ -17,17 +17,3 @@ void pbl_set_putc(putc_func_t putcf, void *ctx)
 	__console_set_putc(&console_ll, putcf, ctx);
 }
 
-int pr_print(int level, const char *fmt, ...)
-{
-	va_list args;
-	uint i;
-	char printbuffer[CFG_PBSIZE];
-
-	va_start(args, fmt);
-	i = vsprintf(printbuffer, fmt, args);
-	va_end(args);
-
-	console_puts(CONSOLE_STDOUT, printbuffer);
-
-	return i;
-}
-- 
2.17.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux