diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-11-20 08:21:21 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-11-21 07:51:35 +0100 |
commit | d6689ffa894e5a863b540542b97cc06929bc447e (patch) | |
tree | e19fe3a4a1fa0acc20b83b3cc24e4dd3389c798f | |
parent | 7fbdba6f210c85afd2765dbf168c988646dfeabf (diff) | |
download | barebox-d6689ffa894e5a863b540542b97cc06929bc447e.tar.gz barebox-d6689ffa894e5a863b540542b97cc06929bc447e.tar.xz |
console: define barebox_set_loglevel
Selftests may want to change barebox_loglevel temporarily to avoid expected
warning or error messages cluttering the log. barebox_loglevel is only
defined for !CONFIG_CONSOLE_NONE though, so add a stub for the
console-less case.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20231120072122.2006805-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | include/console.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/console.h b/include/console.h index 787bfd773d..d7cbdfa992 100644 --- a/include/console.h +++ b/include/console.h @@ -95,8 +95,6 @@ struct console_device *of_console_get_by_alias(const char *alias); #define CFG_PBSIZE (CONFIG_CBSIZE+sizeof(CONFIG_PROMPT)+16) -extern int barebox_loglevel; - int console_open(struct console_device *cdev); int console_close(struct console_device *cdev); int console_set_active(struct console_device *cdev, unsigned active); @@ -200,6 +198,14 @@ extern struct list_head console_list; #define for_each_console(console) list_for_each_entry(console, &console_list, list) struct console_device *console_get_first_active(void); + +extern int barebox_loglevel; +static inline int barebox_set_loglevel(int loglevel) +{ + int old_loglevel = barebox_loglevel; + barebox_loglevel = loglevel; + return old_loglevel; +} #else #define for_each_console(console) while (((void)console, 0)) @@ -207,6 +213,11 @@ static inline struct console_device *console_get_first_active(void) { return NULL; } + +static inline int barebox_set_loglevel(int loglevel) +{ + return loglevel; +} #endif #ifdef CONFIG_CONSOLE_FULL |