Skip to content

Commit cb8c90a

Browse files
nivedita76ardbiesheuvel
authored andcommitted
efi/libstub: Rename efi_[char16_]printk to efi_[char16_]puts
These functions do not support formatting, unlike printk. Rename them to puts to make that clear. Move the implementations of these two functions next to each other. Signed-off-by: Arvind Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 0b76735 commit cb8c90a

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

drivers/firmware/efi/libstub/efi-stub-helper.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,21 @@ bool __pure __efi_soft_reserve_enabled(void)
2626
return !efi_nosoftreserve;
2727
}
2828

29-
void efi_printk(const char *str)
29+
void efi_char16_puts(efi_char16_t *str)
30+
{
31+
efi_call_proto(efi_table_attr(efi_system_table, con_out),
32+
output_string, str);
33+
}
34+
35+
void efi_puts(const char *str)
3036
{
3137
while (*str) {
3238
efi_char16_t ch[] = { *str++, L'\0' };
3339

3440
if (ch[0] == L'\n')
35-
efi_char16_printk(L"\r\n");
41+
efi_char16_puts(L"\r\n");
3642
else
37-
efi_char16_printk(ch);
43+
efi_char16_puts(ch);
3844
}
3945
}
4046

@@ -279,12 +285,6 @@ void *get_efi_config_table(efi_guid_t guid)
279285
return NULL;
280286
}
281287

282-
void efi_char16_printk(efi_char16_t *str)
283-
{
284-
efi_call_proto(efi_table_attr(efi_system_table, con_out),
285-
output_string, str);
286-
}
287-
288288
/*
289289
* The LINUX_EFI_INITRD_MEDIA_GUID vendor media device path below provides a way
290290
* for the firmware or bootloader to expose the initrd data directly to the stub

drivers/firmware/efi/libstub/efistub.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ extern const efi_system_table_t *efi_system_table;
4949
#endif
5050

5151
#define efi_info(msg) do { \
52-
if (!efi_quiet) efi_printk("EFI stub: "msg); \
52+
if (!efi_quiet) efi_puts("EFI stub: "msg); \
5353
} while (0)
5454

55-
#define efi_err(msg) efi_printk("EFI stub: ERROR: "msg)
55+
#define efi_err(msg) efi_puts("EFI stub: ERROR: "msg)
5656

5757
/* Helper macros for the usual case of using simple C variables: */
5858
#ifndef fdt_setprop_inplace_var
@@ -605,8 +605,6 @@ efi_status_t efi_exit_boot_services(void *handle,
605605
void *priv,
606606
efi_exit_boot_map_processing priv_func);
607607

608-
void efi_char16_printk(efi_char16_t *);
609-
610608
efi_status_t allocate_new_fdt_and_exit_boot(void *handle,
611609
unsigned long *new_fdt_addr,
612610
unsigned long max_addr,
@@ -630,7 +628,9 @@ efi_status_t check_platform_features(void);
630628

631629
void *get_efi_config_table(efi_guid_t guid);
632630

633-
void efi_printk(const char *str);
631+
/* NOTE: These functions do not print a trailing newline after the string */
632+
void efi_char16_puts(efi_char16_t *);
633+
void efi_puts(const char *str);
634634

635635
void efi_free(unsigned long size, unsigned long addr);
636636

drivers/firmware/efi/libstub/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ static efi_status_t efi_open_file(efi_file_protocol_t *volume,
4747
status = volume->open(volume, &fh, fi->filename, EFI_FILE_MODE_READ, 0);
4848
if (status != EFI_SUCCESS) {
4949
efi_err("Failed to open file: ");
50-
efi_char16_printk(fi->filename);
51-
efi_printk("\n");
50+
efi_char16_puts(fi->filename);
51+
efi_puts("\n");
5252
return status;
5353
}
5454

0 commit comments

Comments
 (0)