mirror of https://github.com/ipxe/ipxe.git
[efi] Allow efidev_parent() to traverse multiple device generations
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/41/head
parent
fa18bc4205
commit
5cea7bdb2a
|
@ -68,18 +68,16 @@ static struct efi_device * efidev_find ( EFI_HANDLE device ) {
|
||||||
* @ret efidev Parent EFI device, or NULL
|
* @ret efidev Parent EFI device, or NULL
|
||||||
*/
|
*/
|
||||||
struct efi_device * efidev_parent ( struct device *dev ) {
|
struct efi_device * efidev_parent ( struct device *dev ) {
|
||||||
struct device *parent = dev->parent;
|
struct device *parent;
|
||||||
struct efi_device *efidev;
|
|
||||||
|
|
||||||
/* Check that parent exists and is an EFI device */
|
/* Walk upwards until we find an EFI device */
|
||||||
if ( ! parent )
|
while ( ( parent = dev->parent ) ) {
|
||||||
return NULL;
|
if ( parent->desc.bus_type == BUS_TYPE_EFI )
|
||||||
if ( parent->desc.bus_type != BUS_TYPE_EFI )
|
return container_of ( parent, struct efi_device, dev );
|
||||||
return NULL;
|
dev = parent;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get containing EFI device */
|
return NULL;
|
||||||
efidev = container_of ( parent, struct efi_device, dev );
|
|
||||||
return efidev;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue