From patchwork Tue Jun 28 12:59:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 585921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42150C433EF for ; Tue, 28 Jun 2022 12:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231840AbiF1M7q (ORCPT ); Tue, 28 Jun 2022 08:59:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233051AbiF1M7p (ORCPT ); Tue, 28 Jun 2022 08:59:45 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0D3742FFD3 for ; Tue, 28 Jun 2022 05:59:44 -0700 (PDT) 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 06924152B; Tue, 28 Jun 2022 05:59:44 -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 0EE2D3F5A1; Tue, 28 Jun 2022 05:59:42 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org Cc: Sudeep Holla , Ard Biesheuvel , Russell King Subject: [PATCH] ARM: efi: Simplify arch_efi_call_virt() macro by using typeof() Date: Tue, 28 Jun 2022 13:59:38 +0100 Message-Id: <20220628125938.694256-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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: Russell King Signed-off-by: Sudeep Holla --- arch/arm/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/arm/include/asm/efi.h b/arch/arm/include/asm/efi.h index 27218eabbf9a..d4a405c9b4b6 100644 --- a/arch/arm/include/asm/efi.h +++ b/arch/arm/include/asm/efi.h @@ -26,8 +26,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; \ + typeof(p->f) __f = p->f; \ __f(args); \ })