All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] LoongArch: efi: Simplify arch_efi_call_virt() macro by using typeof()
@ 2022-06-28 13:00 Sudeep Holla
  0 siblings, 0 replies; only message in thread
From: Sudeep Holla @ 2022-06-28 13:00 UTC (permalink / raw)
  To: loongarch, linux-efi
  Cc: Sudeep Holla, Ard Biesheuvel, Huacai Chen, WANG Xuerui

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 using typeof(p->f) which must
be a pointer as required by __efi_rt_asm_wrapper() and eliminate the
explicit need for efi_##f##_t type for every user of this macro.

This change is done to align with implementations on other similar
architectures.

Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 arch/loongarch/include/asm/efi.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Hi,

Reference for this change [1] and in particular[2]

Regards,
Sudeep

[1] https://lore.kernel.org/r/20220628125346.693304-1-sudeep.holla@arm.com
[2] https://lore.kernel.org/r/20220628125346.693304-3-sudeep.holla@arm.com/

diff --git a/arch/loongarch/include/asm/efi.h b/arch/loongarch/include/asm/efi.h
index 0127d84d5e1d..b5f23b501196 100644
--- a/arch/loongarch/include/asm/efi.h
+++ b/arch/loongarch/include/asm/efi.h
@@ -19,8 +19,7 @@ void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
 
 #define arch_efi_call_virt(p, f, args...)        \
 ({                                               \
-	efi_##f##_t * __f;                       \
-	__f = p->f;                              \
+	typeof(p->f) __f = p->f;                 \
 	__f(args);                               \
 })
 
-- 
2.37.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-28 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 13:00 [PATCH] LoongArch: efi: Simplify arch_efi_call_virt() macro by using typeof() Sudeep Holla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.