mirror of https://github.com/ipxe/ipxe.git
[efi] Use efi_open_by_child() for all by-child protocol opens
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/34/merge
parent
358db15612
commit
4561a03766
|
@ -120,19 +120,12 @@ int efi_locate_device ( EFI_HANDLE device, EFI_GUID *protocol,
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int efi_child_add ( EFI_HANDLE parent, EFI_HANDLE child ) {
|
int efi_child_add ( EFI_HANDLE parent, EFI_HANDLE child ) {
|
||||||
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
|
||||||
void *devpath;
|
void *devpath;
|
||||||
EFI_STATUS efirc;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Re-open the device path protocol */
|
/* Re-open the device path protocol */
|
||||||
if ( ( efirc = bs->OpenProtocol ( parent,
|
if ( ( rc = efi_open_by_child ( parent, &efi_device_path_protocol_guid,
|
||||||
&efi_device_path_protocol_guid,
|
child, &devpath ) ) != 0 ) {
|
||||||
&devpath,
|
|
||||||
efi_image_handle, child,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
|
||||||
) ) != 0 ) {
|
|
||||||
rc = -EEFI ( efirc );
|
|
||||||
DBGC ( parent, "EFIDEV %s could not add child",
|
DBGC ( parent, "EFIDEV %s could not add child",
|
||||||
efi_handle_name ( parent ) );
|
efi_handle_name ( parent ) );
|
||||||
DBGC ( parent, " %s: %s\n",
|
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
|
* @v child EFI child device handle
|
||||||
*/
|
*/
|
||||||
void efi_child_del ( EFI_HANDLE parent, EFI_HANDLE child ) {
|
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_close_by_child ( parent, &efi_device_path_protocol_guid, child );
|
||||||
efi_image_handle, child );
|
|
||||||
DBGC2 ( parent, "EFIDEV %s removed child", efi_handle_name ( parent ) );
|
DBGC2 ( parent, "EFIDEV %s removed child", efi_handle_name ( parent ) );
|
||||||
DBGC2 ( parent, " %s\n", efi_handle_name ( child ) );
|
DBGC2 ( parent, " %s\n", efi_handle_name ( child ) );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue