summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2017-10-26 19:25:57 +0200
committerAlexander Graf <agraf@suse.de>2017-12-01 13:22:56 +0100
commit9172cd91fa58da48f31259c51536aa8778bd72da (patch)
tree21574ba71b462b41154940b2cd0d43946c080eec /lib
parent5810511dac980929dbfe57e25ccdf72d5b7e38e4 (diff)
efi_loader: simplify efi_locate_protocol
Use helper function efi_search_protocol. Do not print protocol guid twice in debug mode. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_boottime.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f32ddd50227..9e8d8f486e0 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1778,29 +1778,23 @@ static efi_status_t EFIAPI efi_locate_protocol(const efi_guid_t *protocol,
void **protocol_interface)
{
struct list_head *lhandle;
- int i;
+ efi_status_t ret;
EFI_ENTRY("%pUl, %p, %p", protocol, registration, protocol_interface);
if (!protocol || !protocol_interface)
return EFI_EXIT(EFI_INVALID_PARAMETER);
- EFI_PRINT_GUID("protocol", protocol);
-
list_for_each(lhandle, &efi_obj_list) {
struct efi_object *efiobj;
+ struct efi_handler *handler;
efiobj = list_entry(lhandle, struct efi_object, link);
- for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) {
- struct efi_handler *handler = &efiobj->protocols[i];
- if (!handler->guid)
- continue;
- if (!guidcmp(handler->guid, protocol)) {
- *protocol_interface =
- handler->protocol_interface;
- return EFI_EXIT(EFI_SUCCESS);
- }
+ ret = efi_search_protocol(efiobj->handle, protocol, &handler);
+ if (ret == EFI_SUCCESS) {
+ *protocol_interface = handler->protocol_interface;
+ return EFI_EXIT(EFI_SUCCESS);
}
}
*protocol_interface = NULL;