]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Use efi_open_by_child() for all by-child protocol opens
authorMichael Brown <mcb30@ipxe.org>
Sun, 23 Mar 2025 17:49:39 +0000 (17:49 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 24 Mar 2025 13:19:26 +0000 (13:19 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_utils.c

index 6ceba20e6a3d9ddc1adf93fa73d24da14c0b7afa..928d8e53ae64ebcc5b994109249c90f97a693dfa 100644 (file)
@@ -120,19 +120,12 @@ int efi_locate_device ( EFI_HANDLE device, EFI_GUID *protocol,
  * @ret rc             Return status code
  */
 int efi_child_add ( EFI_HANDLE parent, EFI_HANDLE child ) {
-       EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        void *devpath;
-       EFI_STATUS efirc;
        int rc;
 
        /* Re-open the device path protocol */
-       if ( ( efirc = bs->OpenProtocol ( parent,
-                                         &efi_device_path_protocol_guid,
-                                         &devpath,
-                                         efi_image_handle, child,
-                                         EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
-                                         ) ) != 0 ) {
-               rc = -EEFI ( efirc );
+       if ( ( rc = efi_open_by_child ( parent, &efi_device_path_protocol_guid,
+                                       child, &devpath ) ) != 0 ) {
                DBGC ( parent, "EFIDEV %s could not add child",
                       efi_handle_name ( parent ) );
                DBGC ( parent, " %s: %s\n",
@@ -154,10 +147,8 @@ int efi_child_add ( EFI_HANDLE parent, EFI_HANDLE child ) {
  * @v child            EFI child device handle
  */
 void efi_child_del ( EFI_HANDLE parent, EFI_HANDLE child ) {
-       EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
 
-       bs->CloseProtocol ( parent, &efi_device_path_protocol_guid,
-                           efi_image_handle, child );
+       efi_close_by_child ( parent, &efi_device_path_protocol_guid, child );
        DBGC2 ( parent, "EFIDEV %s removed child", efi_handle_name ( parent ) );
        DBGC2 ( parent, " %s\n", efi_handle_name ( child ) );
 }