[PATCH v7 3/7] common: console: introduce console_record_isempty helper
Svyatoslav Ryhel
clamor95 at gmail.com
Fri Jan 5 08:22:08 CET 2024
From: Ion Agorria <ion at agorria.com>
Add console_record_isempty to check if console record buffer
contains any data.
Signed-off-by: Ion Agorria <ion at agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
---
common/console.c | 5 +++++
include/console.h | 13 +++++++++++++
2 files changed, 18 insertions(+)
diff --git a/common/console.c b/common/console.c
index 1ffda49c87..6f2089caa0 100644
--- a/common/console.c
+++ b/common/console.c
@@ -853,6 +853,11 @@ int console_record_avail(void)
return membuff_avail((struct membuff *)&gd->console_out);
}
+bool console_record_isempty(void)
+{
+ return membuff_isempty((struct membuff *)&gd->console_out);
+}
+
int console_in_puts(const char *str)
{
return membuff_put((struct membuff *)&gd->console_in, str, strlen(str));
diff --git a/include/console.h b/include/console.h
index e29817e57b..2617e16007 100644
--- a/include/console.h
+++ b/include/console.h
@@ -84,6 +84,13 @@ int console_record_readline(char *str, int maxlen);
*/
int console_record_avail(void);
+/**
+ * console_record_isempty() - Returns if console output is empty
+ *
+ * Return: true if empty
+ */
+bool console_record_isempty(void);
+
/**
* console_in_puts() - Write a string to the console input buffer
*
@@ -131,6 +138,12 @@ static inline int console_in_puts(const char *str)
return 0;
}
+static inline bool console_record_isempty(void)
+{
+ /* Always empty */
+ return true;
+}
+
#endif /* !CONFIG_CONSOLE_RECORD */
/**
--
2.40.1
More information about the U-Boot
mailing list