From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 236ECC433EF for ; Tue, 28 Jun 2022 13:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oFLoOQ7rprQ6V412Jb1BmkTaeougeqwK4jNaxmdlVVY=; b=JoZwLrDHF1eCwQ YeiUCl/GZ59/exMNJXs0DZL9Z80XYSuFp3EFto/6C4QvItsck5+4zKIMBrKzUmOvll9QEckd4hYoS wPhB3/dVGXp2ppTQG0j0DoAyhg4f5lSubvkPVBw0m/xUyvdUC3KvBnV23Dg0c7IpaIUmZIwL6uYmF N/eFXnY4u69c6+TNlCLT3DcPCKcyZRo/JVVTuToR28eQbTuwhky2KfPhkbn4t4uakxyNFe6Lr59/6 du8BroatMsPxrZLYjIaOliSf2PDFqwiK8mYO+1FzCOBFtzfvevaZJPpN/8+buMsCu9iiJgVhHNWPA GZGp0i9jrgom13uQJpwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6BZD-006WKG-TK; Tue, 28 Jun 2022 13:47:48 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6BZ9-006WJC-R3 for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 13:47:45 +0000 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 27AF0152B; Tue, 28 Jun 2022 06:47:42 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 309CA3F5A1; Tue, 28 Jun 2022 06:47:41 -0700 (PDT) Date: Tue, 28 Jun 2022 14:47:38 +0100 From: Sudeep Holla To: Ard Biesheuvel Cc: Linux ARM , linux-efi , Sudeep Holla , Russell King Subject: Re: [PATCH] ARM: efi: Simplify arch_efi_call_virt() macro by using typeof() Message-ID: <20220628134738.xqj6gu5ngbsuql2f@bogus> References: <20220628125938.694256-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_064743_994734_65CA225A X-CRM114-Status: GOOD ( 23.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 28, 2022 at 03:16:26PM +0200, Ard Biesheuvel wrote: > On Tue, 28 Jun 2022 at 14:59, Sudeep Holla wrote: > > > > 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); \ > > }) > > > > I think this could simply be > > #define arch_efi_call_virt(p, f, args...) ((p)->f(args)) > > no? Yes, I came to similar conclusion just after sending this out as I started to look if we can have one generic definition for arm/arm64/riscv/loongarch. I am yet to figure out how asm/efi.h and linux/efi.h are included so that we can have generic definition in linux/efi.h and x86 can undefine that and redefine its own version. Does that make sense ? -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel