]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Eliminate uses of HandleProtocol()
authorMichael Brown <mcb30@ipxe.org>
Mon, 24 Mar 2025 14:22:54 +0000 (14:22 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 24 Mar 2025 14:25:10 +0000 (14:25 +0000)
It is now simpler to use efi_open() than to use HandleProtocol() to
obtain an ephemeral protocol instance.  Remove all remaining uses of
HandleProtocol() to simplify the code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_debug.c
src/interface/efi/efi_file.c

index ef650d989a48e56e3382dde2ce0cfbf00f41263d..fd4997cccc50b7242639cf203431396d1d91e8fa 100644 (file)
@@ -162,15 +162,11 @@ void dbg_efi_openers ( EFI_HANDLE handle, EFI_GUID *protocol ) {
  * @v protocol         Protocol GUID
  */
 void dbg_efi_protocol ( EFI_HANDLE handle, EFI_GUID *protocol ) {
-       EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        VOID *interface;
-       EFI_STATUS efirc;
        int rc;
 
        /* Get protocol instance */
-       if ( ( efirc = bs->HandleProtocol ( handle, protocol,
-                                           &interface ) ) != 0 ) {
-               rc = -EEFI ( efirc );
+       if ( ( rc = efi_open ( handle, protocol, &interface ) ) != 0 ) {
                printf ( "HANDLE %s could not identify %s: %s\n",
                         efi_handle_name ( handle ),
                         efi_guid_ntoa ( protocol ), strerror ( rc ) );
index f31f2fe3bab7acd30fbb3d3254e6d0a39f005003..d8b9f819c67d1522e13d9f50dc5eb989df04c452 100644 (file)
@@ -1000,10 +1000,8 @@ static int efi_file_path_claim ( struct efi_file_path *file ) {
        }
 
        /* Locate device path protocol on this handle */
-       if ( ( ( efirc = bs->HandleProtocol ( handle,
-                                             &efi_device_path_protocol_guid,
-                                             &old ) ) != 0 ) ) {
-               rc = -EEFI ( efirc );
+       if ( ( rc = efi_open ( handle, &efi_device_path_protocol_guid,
+                              &old ) != 0 ) ) {
                DBGC ( file, "EFIFILE %s could not locate %s: %s\n",
                       efi_file_name ( &file->file ),
                       efi_devpath_text ( file->path ), strerror ( rc ) );