[U-Boot] [PATCH 23/38] efi: Move inline functions to unconditional part of header
Simon Glass
sjg at chromium.org
Mon Aug 26 15:59:28 UTC 2019
At present these two functions are defined in efi_loader.h but only if
CONFIG_EFI_LOADER is enabled. But these are functions that are useful to
other code, such as that which deals with Intel Handoff Blocks (HOBs).
Move these to the top of the function.
Possibly ascii2unicode() should not be an inline function, since this
might impact code size.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
In general it seems to be bad form to include parts of headers
conditionally.
include/efi_loader.h | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 5298ea7997..82f236e295 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -12,6 +12,27 @@
#include <part_efi.h>
#include <efi_api.h>
+/**
+ * ascii2unicode() - convert ASCII string to UTF-16 string
+ *
+ * A zero terminated ASCII string is converted to a zero terminated UTF-16
+ * string. The output buffer must be preassigned.
+ *
+ * @unicode: preassigned output buffer for UTF-16 string
+ * @ascii: ASCII string to be converted
+ */
+static inline void ascii2unicode(u16 *unicode, const char *ascii)
+{
+ while (*ascii)
+ *(unicode++) = *(ascii++);
+ *unicode = 0;
+}
+
+static inline int guidcmp(const void *g1, const void *g2)
+{
+ return memcmp(g1, g2, sizeof(efi_guid_t));
+}
+
/* No need for efi loader support in SPL */
#if CONFIG_IS_ENABLED(EFI_LOADER)
@@ -551,27 +572,6 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
(((_dp)->type == DEVICE_PATH_TYPE_##_type) && \
((_dp)->sub_type == DEVICE_PATH_SUB_TYPE_##_subtype))
-/**
- * ascii2unicode() - convert ASCII string to UTF-16 string
- *
- * A zero terminated ASCII string is converted to a zero terminated UTF-16
- * string. The output buffer must be preassigned.
- *
- * @unicode: preassigned output buffer for UTF-16 string
- * @ascii: ASCII string to be converted
- */
-static inline void ascii2unicode(u16 *unicode, const char *ascii)
-{
- while (*ascii)
- *(unicode++) = *(ascii++);
- *unicode = 0;
-}
-
-static inline int guidcmp(const void *g1, const void *g2)
-{
- return memcmp(g1, g2, sizeof(efi_guid_t));
-}
-
/*
* Use these to indicate that your code / data should go into the EFI runtime
* section and thus still be available when the OS is running
--
2.23.0.187.g17f5b7556c-goog
More information about the U-Boot
mailing list