summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/console_output.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/common/console_output.c b/common/console_output.c
index 237c45cba6..aa7a558bf7 100644
--- a/common/console_output.c
+++ b/common/console_output.c
@@ -63,6 +63,13 @@ void console_channel_disable(const char *name)
if (index >= 0 && index != CC_COMMAND)
channel_mask &= ~CC_MASK(index);
}
+
+bool console_channel_is_disabled(enum console_channel channel)
+{
+ if (!(CC_MASK(channel) & channel_mask))
+ return true;
+ return false;
+}
#endif /* CONFIG_CONSOLE_CHANNEL */
/*****************************************************************************/
@@ -72,11 +79,9 @@ int cputs(enum console_channel channel, const char *outstr)
{
int rv1, rv2;
-#ifdef CONFIG_CONSOLE_CHANNEL
/* Filter out inactive channels */
- if (!(CC_MASK(channel) & channel_mask))
+ if (console_channel_is_disabled(channel))
return EC_SUCCESS;
-#endif
rv1 = usb_puts(outstr);
rv2 = uart_puts(outstr);
@@ -89,11 +94,9 @@ int cprintf(enum console_channel channel, const char *format, ...)
int rv1, rv2;
va_list args;
-#ifdef CONFIG_CONSOLE_CHANNEL
/* Filter out inactive channels */
- if (!(CC_MASK(channel) & channel_mask))
+ if (console_channel_is_disabled(channel))
return EC_SUCCESS;
-#endif
usb_va_start(args, format);
rv1 = usb_vprintf(format, args);
@@ -111,11 +114,9 @@ int cprints(enum console_channel channel, const char *format, ...)
int r, rv;
va_list args;
-#ifdef CONFIG_CONSOLE_CHANNEL
/* Filter out inactive channels */
- if (!(CC_MASK(channel) & channel_mask))
+ if (console_channel_is_disabled(channel))
return EC_SUCCESS;
-#endif
rv = cprintf(channel, "[%pT ", PRINTF_TIMESTAMP_NOW);