aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIon Agorria <ion@agorria.com>2024-01-05 09:22:08 +0200
committerMattijs Korpershoek <mkorpershoek@baylibre.com>2024-01-09 14:58:33 +0100
commit9ce75f49127858d1aa36d455a869137e4d36681b (patch)
treeb5b04e4a9835ae20f7b5c07d7e34516b141ffc38
parent475aa9aabee7ab472341d755cc339f1345d5f49e (diff)
downloadu-boot-9ce75f49127858d1aa36d455a869137e4d36681b.zip
u-boot-9ce75f49127858d1aa36d455a869137e4d36681b.tar.gz
u-boot-9ce75f49127858d1aa36d455a869137e4d36681b.tar.bz2
common: console: introduce console_record_isempty helper
Add console_record_isempty to check if console record buffer contains any data. Signed-off-by: Ion Agorria <ion@agorria.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20240105072212.6615-4-clamor95@gmail.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
-rw-r--r--common/console.c5
-rw-r--r--include/console.h13
2 files changed, 18 insertions, 0 deletions
diff --git a/common/console.c b/common/console.c
index 1ffda49..6f2089c 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 e29817e..2617e16 100644
--- a/include/console.h
+++ b/include/console.h
@@ -85,6 +85,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
*
* This writes the given string to the console_in buffer which will then be
@@ -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 */
/**