summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2021-09-22 14:54:21 -0400
committerTom Rini <[email protected]>2021-09-22 14:54:21 -0400
commit63823da4b9e25d2f6a81f1e9adb06391837055cb (patch)
tree3ee694f9c5342307b1bbb4123276a5eeff77d57f /include
parent44131caa4025455a659e958281f0e337bdf83f89 (diff)
parent121a165c51cd281e61c9d45c3919608af42ca9cd (diff)
Merge branch '2021-09-22-general-updates' into next
- Some sandbox improvements - Make cleanups related to the overusage of the exact build time variable.
Diffstat (limited to 'include')
-rw-r--r--include/configs/bcmstb.h1
-rw-r--r--include/dm/device.h4
-rw-r--r--include/dm/uclass.h2
-rw-r--r--include/os.h21
-rw-r--r--include/test/ut.h24
-rw-r--r--include/version.h8
-rw-r--r--include/version_string.h8
7 files changed, 56 insertions, 12 deletions
diff --git a/include/configs/bcmstb.h b/include/configs/bcmstb.h
index 7f1c298cdce..564425ef56a 100644
--- a/include/configs/bcmstb.h
+++ b/include/configs/bcmstb.h
@@ -10,7 +10,6 @@
#ifndef __BCMSTB_H
#define __BCMSTB_H
-#include "version.h"
#include <linux/sizes.h>
#ifndef __ASSEMBLY__
diff --git a/include/dm/device.h b/include/dm/device.h
index 0a9718a5b81..ef6241bca8b 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -738,7 +738,7 @@ int device_find_next_child(struct udevice **devp);
*
* @parent: Parent device to search
* @uclass_id: Uclass to look for
- * @devp: Returns device found, if any
+ * @devp: Returns device found, if any, else NULL
* @return 0 if found, else -ENODEV
*/
int device_find_first_inactive_child(const struct udevice *parent,
@@ -750,7 +750,7 @@ int device_find_first_inactive_child(const struct udevice *parent,
*
* @parent: Parent device to search
* @uclass_id: Uclass to look for
- * @devp: Returns first child device in that uclass, if any
+ * @devp: Returns first child device in that uclass, if any, else NULL
* @return 0 if found, else -ENODEV
*/
int device_find_first_child_by_uclass(const struct udevice *parent,
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index da0c1bfadb1..15e5f9ef5bc 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -354,7 +354,7 @@ int uclass_next_device(struct udevice **devp);
* The device returned is probed if necessary, and ready for use
*
* @devp: On entry, pointer to device to lookup. On exit, returns pointer
- * to the next device in the uclass if no error occurred, or -ENODEV if
+ * to the next device in the uclass if no error occurred, or NULL if
* there is no next device.
* @return 0 if found, -ENODEV if not found, other -ve on error
*/
diff --git a/include/os.h b/include/os.h
index 7b20d606dd0..770d76e02f7 100644
--- a/include/os.h
+++ b/include/os.h
@@ -52,6 +52,14 @@ off_t os_lseek(int fd, off_t offset, int whence);
#define OS_SEEK_END 2
/**
+ * os_filesize() - Calculate the size of a file
+ *
+ * @fd: File descriptor as returned by os_open()
+ * Return: file size or negative error code
+ */
+int os_filesize(int fd);
+
+/**
* Access to the OS open() system call
*
* @pathname: Pathname of file to open
@@ -398,6 +406,19 @@ int os_write_file(const char *name, const void *buf, int size);
*/
int os_read_file(const char *name, void **bufp, int *sizep);
+/**
+ * os_map_file() - Map a file from the host filesystem into memory
+ *
+ * This can be useful when to provide a backing store for an emulated device
+ *
+ * @pathname: File pathname to map
+ * @os_flags: Flags, like OS_O_RDONLY, OS_O_RDWR
+ * @bufp: Returns buffer containing the file
+ * @sizep: Returns size of data
+ * Return: 0 if OK, -ve on error
+ */
+int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep);
+
/*
* os_find_text_base() - Find the text section in this running process
*
diff --git a/include/test/ut.h b/include/test/ut.h
index 656e25fe574..fb2e5fcff2c 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -83,6 +83,21 @@ int ut_check_console_linen(struct unit_test_state *uts, const char *fmt, ...)
int ut_check_skipline(struct unit_test_state *uts);
/**
+ * ut_check_skip_to_line() - skip output until a line is found
+ *
+ * This creates a string and then checks it against the following lines of
+ * console output obtained with console_record_readline() until it is found.
+ *
+ * After the function returns, uts->expect_str holds the expected string and
+ * uts->actual_str holds the actual string read from the console.
+ *
+ * @uts: Test state
+ * @fmt: printf() format string to look for, followed by args
+ * @return 0 if OK, -ENOENT if not found, other value on error
+ */
+int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...);
+
+/**
* ut_check_console_end() - Check there is no more console output
*
* After the function returns, uts->actual_str holds the actual string read
@@ -286,6 +301,15 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes);
return CMD_RET_FAILURE; \
} \
+/* Assert that a following console output line matches */
+#define ut_assert_skip_to_line(fmt, args...) \
+ if (ut_check_skip_to_line(uts, fmt, ##args)) { \
+ ut_failf(uts, __FILE__, __LINE__, __func__, \
+ "console", "\nExpected '%s',\n got to '%s'", \
+ uts->expect_str, uts->actual_str); \
+ return CMD_RET_FAILURE; \
+ } \
+
/* Assert that there is no more console output */
#define ut_assert_console_end() \
if (ut_check_console_end(uts)) { \
diff --git a/include/version.h b/include/version.h
index 2d24451569d..5955b21e890 100644
--- a/include/version.h
+++ b/include/version.h
@@ -7,16 +7,8 @@
#ifndef __VERSION_H__
#define __VERSION_H__
-#include <timestamp.h>
-
#ifndef DO_DEPS_ONLY
#include "generated/version_autogenerated.h"
#endif
-#define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \
- U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING
-
-#ifndef __ASSEMBLY__
-extern const char version_string[];
-#endif /* __ASSEMBLY__ */
#endif /* __VERSION_H__ */
diff --git a/include/version_string.h b/include/version_string.h
new file mode 100644
index 00000000000..a89a6e43705
--- /dev/null
+++ b/include/version_string.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __VERSION_STRING_H__
+#define __VERSION_STRING_H__
+
+extern const char version_string[];
+
+#endif /* __VERSION_STRING_H__ */