[PATCH 1/3] arm64: efi: Simplify arch_efi_call_virt macro by not using efi_##f##_t type

Sudeep Holla sudeep.holla at arm.com
Fri Jun 24 08:23:29 PDT 2022


Currently, the arch_efi_call_virt() assumes all users of it will have
defined a type 'efi_##f##_t' to make use of it. It is unnecessarily
forcing the users to create a new typedef when __efi_rt_asm_wrapper()
actually expects void pointer.

Simplify the arch_efi_call_virt() macro by typecasting p->f to (void *)
as required by __efi_rt_asm_wrapper() and eliminate the explicit need
for efi_##f##_t type for every user of this macro.

This is needed now in preparation to enable PRMT support on ARM64.

Signed-off-by: Sudeep Holla <sudeep.holla at arm.com>
---
 arch/arm64/include/asm/efi.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Hi Ard,

I am not sure if you prefer to add type for each users of this or this
is acceptable. I see only compile time advantage but I am not sure if
it make sense to add typedefs in ACPI PRMT driver just for this reason.

Let me know.

Regards,
Sudeep

diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index ad55079abe47..263d7fd67207 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -29,9 +29,7 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
 
 #define arch_efi_call_virt(p, f, args...)				\
 ({									\
-	efi_##f##_t *__f;						\
-	__f = p->f;							\
-	__efi_rt_asm_wrapper(__f, #f, args);				\
+	__efi_rt_asm_wrapper((void *)p->f, #f, args);			\
 })
 
 #define arch_efi_call_virt_teardown()					\
-- 
2.36.1




More information about the linux-arm-kernel mailing list