[PATCH 0/8] efi_loader: fix function definitions

When building with 'make W=1' several warnings concerning function definitions are shown. Fix them all.
Heinrich Schuchardt (8): efi_loader: static functions in helloworld.c efi_loader: static functions in efi_boottime.c efi_loader: static functions in efi_console.c efi_loader: static functions in efi_runtime.c efi_loader: provide definition for efi_add_known_memory() efi_loader: include definition of allow_unaligned() efi_loader: make gop_blt() static efi_loader: static efi_query_variable_info_runtime()
include/efi_loader.h | 7 +++++++ lib/efi_loader/efi_boottime.c | 6 ++++-- lib/efi_loader/efi_console.c | 2 +- lib/efi_loader/efi_gop.c | 11 ++++++----- lib/efi_loader/efi_runtime.c | 4 ++-- lib/efi_loader/efi_setup.c | 1 + lib/efi_loader/efi_variable.c | 2 +- lib/efi_loader/helloworld.c | 3 ++- 8 files changed, 24 insertions(+), 12 deletions(-)

Make functions that are not used externally static.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/helloworld.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index d565f32745..49fa8cc2f0 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -125,7 +125,7 @@ static void print_config_tables(void) * @systable: system table * @con_out: simple text output protocol */ -void print_load_options(struct efi_loaded_image *loaded_image) +static void print_load_options(struct efi_loaded_image *loaded_image) { /* Output the load options */ con_out->output_string(con_out, u"Load options: "); @@ -143,6 +143,7 @@ void print_load_options(struct efi_loaded_image *loaded_image) * @device_path: device path to print * @dp2txt: device path to text protocol */ +static efi_status_t print_device_path(struct efi_device_path *device_path, struct efi_device_path_to_text_protocol *dp2txt) {

Make functions that are no used externally static.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/efi_boottime.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ba28989f36..caaab685ee 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -264,7 +264,7 @@ static void efi_queue_event(struct efi_event *event) * @tpl: TPL level to check * Return: status code */ -efi_status_t is_valid_tpl(efi_uintn_t tpl) +static efi_status_t is_valid_tpl(efi_uintn_t tpl) { switch (tpl) { case TPL_APPLICATION: @@ -592,7 +592,7 @@ efi_status_t efi_remove_protocol(const efi_handle_t handle, * * Return: status code */ -efi_status_t efi_remove_all_protocols(const efi_handle_t handle) +static efi_status_t efi_remove_all_protocols(const efi_handle_t handle) { struct efi_object *efiobj; struct efi_handler *protocol; @@ -728,6 +728,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
/* * efi_create_event_ex() - create an event in a group + * * @type: type of the event to create * @notify_tpl: task priority level of the event * @notify_function: notification function of the event @@ -742,6 +743,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, * * Return: status code */ +static efi_status_t EFIAPI efi_create_event_ex(uint32_t type, efi_uintn_t notify_tpl, void (EFIAPI *notify_function) ( struct efi_event *event,

Define function set_shift_mask() as static as it is not used externally.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/efi_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 1ed8c7aa36..4317630907 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -669,7 +669,7 @@ static LIST_HEAD(cin_notify_functions); * @mod: Xterm shift mask * @key_state: receives the state of the shift, alt, control, and logo keys */ -void set_shift_mask(int mod, struct efi_key_state *key_state) +static void set_shift_mask(int mod, struct efi_key_state *key_state) { key_state->key_shift_state = EFI_SHIFT_STATE_VALID; if (mod) {

Functions that are not used externally should be static.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/efi_runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index ad2ab825d1..cee96bfc7f 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -462,7 +462,7 @@ efi_status_t __weak __efi_runtime EFIAPI efi_set_time(struct efi_time *time) * @scatter_gather_list: pointer to array of physical pointers * Returns: status code */ -efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported( +static efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported( struct efi_capsule_header **capsule_header_array, efi_uintn_t capsule_count, u64 scatter_gather_list) @@ -484,7 +484,7 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported( * @reset_type: type of reset needed for capsule update * Returns: status code */ -efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps_unsupported( +static efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps_unsupported( struct efi_capsule_header **capsule_header_array, efi_uintn_t capsule_count, u64 *maximum_capsule_size,

We should provide a definition in an include for efi_add_known_memory().
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- include/efi_loader.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/efi_loader.h b/include/efi_loader.h index 4560b0d04c..c664d6cdf2 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -1137,4 +1137,11 @@ efi_status_t efi_console_get_u16_string
efi_status_t efi_disk_get_device_name(const efi_handle_t handle, char *buf, int size);
+/** + * efi_add_known_memory() - add memory banks to EFI memory map + * + * This weak function may be overridden for specific architectures. + */ +void efi_add_known_memory(void); + #endif /* _EFI_LOADER_H */

Add missing include.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/efi_setup.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index f0f01d3b1d..69aaefab63 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -11,6 +11,7 @@ #include <efi_loader.h> #include <efi_variable.h> #include <log.h> +#include <asm-generic/unaligned.h>
#define OBJ_LIST_NOT_INITIALIZED 1

This function is not used externally.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/efi_gop.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c index d1dc2f22d0..778b693f98 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c @@ -400,11 +400,12 @@ out: * @delta: length in bytes of a line in the pixel buffer (optional) * Return: status code */ -efi_status_t EFIAPI gop_blt(struct efi_gop *this, struct efi_gop_pixel *buffer, - u32 operation, efi_uintn_t sx, - efi_uintn_t sy, efi_uintn_t dx, - efi_uintn_t dy, efi_uintn_t width, - efi_uintn_t height, efi_uintn_t delta) +static efi_status_t EFIAPI gop_blt(struct efi_gop *this, + struct efi_gop_pixel *buffer, + u32 operation, efi_uintn_t sx, + efi_uintn_t sy, efi_uintn_t dx, + efi_uintn_t dy, efi_uintn_t width, + efi_uintn_t height, efi_uintn_t delta) { efi_status_t ret = EFI_INVALID_PARAMETER; efi_uintn_t vid_bpp;

This function is not used externally and hence should be static.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/efi_variable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 7c32adf6e5..548b42bfa2 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -372,7 +372,7 @@ efi_status_t efi_query_variable_info_int(u32 attributes, * selected type * Returns: status code */ -efi_status_t __efi_runtime EFIAPI efi_query_variable_info_runtime( +static efi_status_t __efi_runtime EFIAPI efi_query_variable_info_runtime( u32 attributes, u64 *maximum_variable_storage_size, u64 *remaining_variable_storage_size,
participants (1)
-
Heinrich Schuchardt