diff options
author | Nico Huber <nico.h@gmx.de> | 2021-03-27 20:03:02 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-04-14 10:38:09 +0000 |
commit | 7cc14ac25d9d40a7c2fc078c248faafbac887a5d (patch) | |
tree | fafe642d5fa78acd01388f77d169af1f9e647ab6 /src | |
parent | 879ccaa7c581c570dbf86ffcf35239a9d9f19eee (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/console/printk.c | 6 | ||||
-rw-r--r-- | src/device/device_util.c | 30 | ||||
-rw-r--r-- | src/include/console/console.h | 18 | ||||
-rw-r--r-- | src/soc/amd/picasso/psp_verstage/printk.c | 6 |
4 files changed, 28 insertions, 32 deletions
diff --git a/src/console/printk.c b/src/console/printk.c index 85d9bfb1e6..1ed39cb5ff 100644 --- a/src/console/printk.c +++ b/src/console/printk.c @@ -69,7 +69,7 @@ static void wrap_putchar_cbmemc(unsigned char byte, void *data) __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 @@ int do_vprintk(int msg_level, const char *fmt, va_list args) 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 71c281e33e..f05f71df86 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -710,14 +710,14 @@ static void resource_tree(const struct device *root, int debug_level, int depth) 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 @@ void print_resource_tree(const struct device *root, int debug_level, { /* 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 @@ void show_devs_tree(const struct device *dev, int debug_level, int depth) 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_devs_tree(const struct device *dev, int debug_level, int depth) 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_all_devs_tree(int debug_level, const char *msg) 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 @@ void show_all_devs(int debug_level, const char *msg) 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 @@ void show_one_resource(int debug_level, struct device *dev, 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 @@ void show_all_devs_resources(int debug_level, const char *msg) { 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 fa61e9100a..17448fe768 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -50,6 +50,10 @@ static inline int get_console_loglevel(void) #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 @@ void do_putchar(unsigned char byte); 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 a99d8bc35d..c56f78c298 100644 --- a/src/soc/amd/picasso/psp_verstage/printk.c +++ b/src/soc/amd/picasso/psp_verstage/printk.c @@ -11,19 +11,19 @@ void console_hw_init(void) __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]; |