Skip to content
Snippets Groups Projects
Commit 5810511d authored by Heinrich Schuchardt's avatar Heinrich Schuchardt Committed by Alexander Graf
Browse files

efi_loader: simplify efi_uninstall_protocol_interface


Use function efi_search_obj, efi_search_protocol and
efi_remove_protocol to simplify the coding.

Signed-off-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent 42cf1242
No related branches found
No related tags found
No related merge requests found
...@@ -906,9 +906,8 @@ static efi_status_t EFIAPI efi_uninstall_protocol_interface( ...@@ -906,9 +906,8 @@ static efi_status_t EFIAPI efi_uninstall_protocol_interface(
void *handle, const efi_guid_t *protocol, void *handle, const efi_guid_t *protocol,
void *protocol_interface) void *protocol_interface)
{ {
struct list_head *lhandle; struct efi_handler *handler;
int i; efi_status_t r;
efi_status_t r = EFI_NOT_FOUND;
EFI_ENTRY("%p, %pUl, %p", handle, protocol, protocol_interface); EFI_ENTRY("%p, %pUl, %p", handle, protocol, protocol_interface);
...@@ -917,31 +916,16 @@ static efi_status_t EFIAPI efi_uninstall_protocol_interface( ...@@ -917,31 +916,16 @@ static efi_status_t EFIAPI efi_uninstall_protocol_interface(
goto out; goto out;
} }
list_for_each(lhandle, &efi_obj_list) { /* Find the protocol on the handle */
struct efi_object *efiobj; r = efi_search_protocol(handle, protocol, &handler);
efiobj = list_entry(lhandle, struct efi_object, link); if (r != EFI_SUCCESS)
goto out;
if (efiobj->handle != handle)
continue;
for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) {
struct efi_handler *handler = &efiobj->protocols[i];
const efi_guid_t *hprotocol = handler->guid;
if (!hprotocol)
continue;
if (!guidcmp(hprotocol, protocol)) {
if (handler->protocol_interface) { if (handler->protocol_interface) {
/* TODO disconnect controllers */
r = EFI_ACCESS_DENIED; r = EFI_ACCESS_DENIED;
} else { } else {
handler->guid = 0; r = efi_remove_protocol(handle, protocol, protocol_interface);
r = EFI_SUCCESS;
}
goto out;
} }
}
}
out: out:
return EFI_EXIT(r); return EFI_EXIT(r);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment