Rename do_printk() to printk()

The indirection seems unnecessary. The macros throw features like
`-Wmisleading-indentation` off, though.

Default build for QEMU/Q35 is unchanged.

Change-Id: Ie4eab935a367b5ad6b38225c4973d41d9f70ef10
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51887
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/src/console/printk.c b/src/console/printk.c
index 85d9bfb..1ed39cb 100644
--- a/src/console/printk.c
+++ b/src/console/printk.c
@@ -69,7 +69,7 @@
 	__cbmemc_tx_byte(byte);
 }
 
-int do_vprintk(int msg_level, const char *fmt, va_list args)
+int vprintk(int msg_level, const char *fmt, va_list args)
 {
 	int i, log_this;
 
@@ -98,13 +98,13 @@
 	return i;
 }
 
-int do_printk(int msg_level, const char *fmt, ...)
+int printk(int msg_level, const char *fmt, ...)
 {
 	va_list args;
 	int i;
 
 	va_start(args, fmt);
-	i = do_vprintk(msg_level, fmt, args);
+	i = vprintk(msg_level, fmt, args);
 	va_end(args);
 
 	return i;
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 71c281e..f05f71d 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -710,14 +710,14 @@
 		indent[i] = ' ';
 	indent[i] = '\0';
 
-	do_printk(BIOS_DEBUG, "%s%s", indent, dev_path(root));
+	printk(BIOS_DEBUG, "%s%s", indent, dev_path(root));
 	if (root->link_list && root->link_list->children)
-		do_printk(BIOS_DEBUG, " child on link 0 %s",
+		printk(BIOS_DEBUG, " child on link 0 %s",
 			  dev_path(root->link_list->children));
-	do_printk(BIOS_DEBUG, "\n");
+	printk(BIOS_DEBUG, "\n");
 
 	for (res = root->resource_list; res; res = res->next) {
-		do_printk(debug_level, "%s%s resource base %llx size %llx "
+		printk(debug_level, "%s%s resource base %llx size %llx "
 			  "align %d gran %d limit %llx flags %lx index %lx\n",
 			  indent, dev_path(root), res->base, res->size,
 			  res->align, res->gran, res->limit, res->flags,
@@ -735,12 +735,12 @@
 {
 	/* Bail if root is null. */
 	if (!root) {
-		do_printk(debug_level, "%s passed NULL for root!\n", __func__);
+		printk(debug_level, "%s passed NULL for root!\n", __func__);
 		return;
 	}
 
 	/* Bail if not printing to screen. */
-	if (!do_printk(debug_level, "Show resources in subtree (%s)...%s\n",
+	if (!printk(debug_level, "Show resources in subtree (%s)...%s\n",
 		       dev_path(root), msg))
 		return;
 
@@ -758,7 +758,7 @@
 		depth_str[i] = ' ';
 	depth_str[i] = '\0';
 
-	do_printk(debug_level, "%s%s: enabled %d\n",
+	printk(debug_level, "%s%s: enabled %d\n",
 		  depth_str, dev_path(dev), dev->enabled);
 
 	for (link = dev->link_list; link; link = link->next) {
@@ -771,7 +771,7 @@
 void show_all_devs_tree(int debug_level, const char *msg)
 {
 	/* Bail if not printing to screen. */
-	if (!do_printk(debug_level, "Show all devs in tree form... %s\n", msg))
+	if (!printk(debug_level, "Show all devs in tree form... %s\n", msg))
 		return;
 	show_devs_tree(all_devices, debug_level, 0);
 }
@@ -779,10 +779,10 @@
 void show_devs_subtree(struct device *root, int debug_level, const char *msg)
 {
 	/* Bail if not printing to screen. */
-	if (!do_printk(debug_level, "Show all devs in subtree %s... %s\n",
+	if (!printk(debug_level, "Show all devs in subtree %s... %s\n",
 		       dev_path(root), msg))
 		return;
-	do_printk(debug_level, "%s\n", msg);
+	printk(debug_level, "%s\n", msg);
 	show_devs_tree(root, debug_level, 0);
 }
 
@@ -791,10 +791,10 @@
 	struct device *dev;
 
 	/* Bail if not printing to screen. */
-	if (!do_printk(debug_level, "Show all devs... %s\n", msg))
+	if (!printk(debug_level, "Show all devs... %s\n", msg))
 		return;
 	for (dev = all_devices; dev; dev = dev->next) {
-		do_printk(debug_level, "%s: enabled %d\n",
+		printk(debug_level, "%s: enabled %d\n",
 			  dev_path(dev), dev->enabled);
 	}
 }
@@ -808,7 +808,7 @@
 	end = resource_end(resource);
 	buf[0] = '\0';
 
-	do_printk(debug_level, "%s %02lx <- [0x%010llx - 0x%010llx] "
+	printk(debug_level, "%s %02lx <- [0x%010llx - 0x%010llx] "
 		  "size 0x%08llx gran 0x%02x %s%s%s\n", dev_path(dev),
 		  resource->index, base, end, resource->size, resource->gran,
 		  buf, resource_type(resource), comment);
@@ -818,12 +818,12 @@
 {
 	struct device *dev;
 
-	if (!do_printk(debug_level, "Show all devs with resources... %s\n", msg))
+	if (!printk(debug_level, "Show all devs with resources... %s\n", msg))
 		return;
 
 	for (dev = all_devices; dev; dev = dev->next) {
 		struct resource *res;
-		do_printk(debug_level, "%s: enabled %d\n",
+		printk(debug_level, "%s: enabled %d\n",
 			  dev_path(dev), dev->enabled);
 		for (res = dev->resource_list; res; res = res->next)
 			show_one_resource(debug_level, dev, res, "");
diff --git a/src/include/console/console.h b/src/include/console/console.h
index fa61e91..17448fe 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -50,6 +50,10 @@
 #if __CONSOLE_ENABLE__
 asmlinkage void console_init(void);
 int console_log_level(int msg_level);
+
+int printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
+int vprintk(int msg_level, const char *fmt, va_list args);
+
 void do_putchar(unsigned char byte);
 
 /* Return number of microseconds elapsed from start of stage or the previous
@@ -57,25 +61,17 @@
 long console_time_get_and_reset(void);
 void console_time_report(void);
 
-#define printk(LEVEL, fmt, args...) do_printk(LEVEL, fmt, ##args)
-#define vprintk(LEVEL, fmt, args) do_vprintk(LEVEL, fmt, args)
-
 enum { CONSOLE_LOG_NONE = 0, CONSOLE_LOG_FAST, CONSOLE_LOG_ALL };
 #else
 static inline void console_init(void) {}
 static inline int console_log_level(int msg_level) { return 0; }
-static inline void
+static inline int
 	__attribute__((format(printf, 2, 3)))
-	printk(int LEVEL, const char *fmt, ...) {}
-static inline void vprintk(int LEVEL, const char *fmt, va_list args) {}
+	printk(int LEVEL, const char *fmt, ...) { return 0; }
+static inline int vprintk(int LEVEL, const char *fmt, va_list args) { return 0; }
 static inline void do_putchar(unsigned char byte) {}
 static inline long console_time_get_and_reset(void) { return 0; }
 static inline void console_time_report(void) {}
 #endif
 
-int do_printk(int msg_level, const char *fmt, ...)
-	__attribute__((format(printf, 2, 3)));
-
-int do_vprintk(int msg_level, const char *fmt, va_list args);
-
 #endif /* CONSOLE_CONSOLE_H_ */
diff --git a/src/soc/amd/picasso/psp_verstage/printk.c b/src/soc/amd/picasso/psp_verstage/printk.c
index a99d8bc..c56f78c 100644
--- a/src/soc/amd/picasso/psp_verstage/printk.c
+++ b/src/soc/amd/picasso/psp_verstage/printk.c
@@ -11,19 +11,19 @@
 	__cbmemc_init();
 }
 
-int do_printk(int msg_level, const char *fmt, ...)
+int printk(int msg_level, const char *fmt, ...)
 {
 	va_list args;
 	int i;
 
 	va_start(args, fmt);
-	i = do_vprintk(msg_level, fmt, args);
+	i = vprintk(msg_level, fmt, args);
 	va_end(args);
 
 	return i;
 }
 
-int do_vprintk(int msg_level, const char *fmt, va_list args)
+int vprintk(int msg_level, const char *fmt, va_list args)
 {
 	int i, cnt, log_this;
 	char buf[256];
diff --git a/tests/stubs/console.c b/tests/stubs/console.c
index 0f1dc24..bd40209 100644
--- a/tests/stubs/console.c
+++ b/tests/stubs/console.c
@@ -4,12 +4,12 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-int do_printk(int msg_level, const char *fmt, ...)
+int printk(int msg_level, const char *fmt, ...)
 {
 	return 0;
 }
 
-int do_vprintk(int msg_level, const char *fmt, va_list args)
+int vprintk(int msg_level, const char *fmt, va_list args)
 {
 	return 0;
 }
diff --git a/util/uio_usbdebug/README b/util/uio_usbdebug/README
index 2d52338..cb5a4c8 100644
--- a/util/uio_usbdebug/README
+++ b/util/uio_usbdebug/README
@@ -29,7 +29,7 @@
 
 linux/uio_ehci_pci.c -	Kernel part of the uio interface.
 
-console/printk.c     -	A do_printk() implementation so you can see debug
+console/printk.c     -	A printk() implementation so you can see debug
 			output with CONFIG_DEBUG_USBDEBUG enabled.
 
 device/*.c lib/*.c   -	Some stubs for (hopefully) unneeded functions for
diff --git a/util/uio_usbdebug/console/printk.c b/util/uio_usbdebug/console/printk.c
index 3ad9b9e..e0aa201 100644
--- a/util/uio_usbdebug/console/printk.c
+++ b/util/uio_usbdebug/console/printk.c
@@ -4,7 +4,7 @@
 #include <stdarg.h>
 #include <console/console.h>
 
-int do_printk(int msg_level, const char *const fmt, ...)
+int printk(int msg_level, const char *const fmt, ...)
 {
 	va_list args;
 	int i;