From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 136113209 for ; Tue, 28 Jun 2022 13:00:10 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 93C2B152B; Tue, 28 Jun 2022 06:00:10 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 78A983F5A1; Tue, 28 Jun 2022 06:00:09 -0700 (PDT) From: Sudeep Holla To: loongarch@lists.linux.dev, linux-efi@vger.kernel.org Cc: Sudeep Holla , Ard Biesheuvel , Huacai Chen , WANG Xuerui Subject: [PATCH] LoongArch: efi: Simplify arch_efi_call_virt() macro by using typeof() Date: Tue, 28 Jun 2022 14:00:06 +0100 Message-Id: <20220628130006.694368-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.0 Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Huacai Chen Cc: WANG Xuerui Signed-off-by: Sudeep Holla --- 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