[PATCH v2 068/113] efi: define efi_handle_t as opaque pointer
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Mar 4 10:59:53 PST 2024
Typedef'ing efi_handle_t as void * means that we don't catch instance
where we pass a double indirect pointer when a normal pointer is
expected.
With loader support, we will start to dereference it anyway, so have it
point at an opaque type instead.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/efi/efi-device.c | 12 ++++++------
include/efi/types.h | 4 +++-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index a533bc43eb37..3a16deab5f6b 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -53,7 +53,7 @@ static int efi_locate_handle(enum efi_locate_search_type search_type,
return 0;
}
-static struct efi_device *efi_find_device(efi_handle_t *handle)
+static struct efi_device *efi_find_device(efi_handle_t handle)
{
struct device *dev;
struct efi_device *efidev;
@@ -80,10 +80,10 @@ static void efi_devinfo(struct device *dev)
efi_guid_string(&efidev->guids[i]));
}
-static efi_handle_t *efi_find_parent(efi_handle_t *handle)
+static efi_handle_t efi_find_parent(efi_handle_t handle)
{
unsigned long handle_count = 0;
- efi_handle_t *handles = NULL, *parent;
+ efi_handle_t *handles = NULL, parent;
unsigned long num_guids;
efi_guid_t **guids;
int ret, i, j, k;
@@ -134,7 +134,7 @@ static efi_handle_t *efi_find_parent(efi_handle_t *handle)
return parent;
}
-static struct efi_device *efi_add_device(efi_handle_t *handle, efi_guid_t **guids,
+static struct efi_device *efi_add_device(efi_handle_t handle, efi_guid_t **guids,
int num_guids)
{
struct efi_device *efidev;
@@ -238,7 +238,7 @@ static int efi_register_device(struct efi_device *efidev)
void efi_register_devices(void)
{
unsigned long handle_count = 0;
- efi_handle_t *handles = NULL;
+ efi_handle_t *handles = NULL;
unsigned long num_guids;
efi_guid_t **guids;
int ret, i;
@@ -402,7 +402,7 @@ static void efi_set_bootsource(void)
enum bootsource src = BOOTSOURCE_UNKNOWN;
int instance = BOOTSOURCE_INSTANCE_UNKNOWN;
- efi_handle_t *efi_parent;
+ efi_handle_t efi_parent;
if (!efi_loaded_image->parent_handle)
goto out;
diff --git a/include/efi/types.h b/include/efi/types.h
index 6e134387692f..3309820416be 100644
--- a/include/efi/types.h
+++ b/include/efi/types.h
@@ -9,7 +9,9 @@
typedef unsigned long efi_status_t;
typedef u16 efi_char16_t; /* UNICODE character */
typedef u64 efi_physical_addr_t;
-typedef void *efi_handle_t;
+
+struct efi_object;
+typedef struct efi_object *efi_handle_t;
/*
* The UEFI spec and EDK2 reference implementation both define EFI_GUID as
--
2.39.2
More information about the barebox
mailing list