From: Sudeep Holla <sudeep.holla@arm.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
linux-efi <linux-efi@vger.kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>,
Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH] ARM: efi: Simplify arch_efi_call_virt() macro by using typeof()
Date: Tue, 28 Jun 2022 14:47:38 +0100 [thread overview]
Message-ID: <20220628134738.xqj6gu5ngbsuql2f@bogus> (raw)
In-Reply-To: <CAMj1kXENKbduN65vs-qAeuiApA8e=_ee5jxVPzRf5kxn8bAzcQ@mail.gmail.com>
On Tue, Jun 28, 2022 at 03:16:26PM +0200, Ard Biesheuvel wrote:
> On Tue, 28 Jun 2022 at 14:59, Sudeep Holla <sudeep.holla@arm.com> 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 <ardb@kernel.org>
> > Cc: Russell King <linux@armlinux.org.uk>
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> > 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
next prev parent reply other threads:[~2022-06-28 13:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 12:59 [PATCH] ARM: efi: Simplify arch_efi_call_virt() macro by using typeof() Sudeep Holla
2022-06-28 13:16 ` Ard Biesheuvel
2022-06-28 13:47 ` Sudeep Holla [this message]
2022-06-28 13:57 ` Ard Biesheuvel
2022-06-28 14:09 ` Sudeep Holla
2022-06-28 17:58 ` Ard Biesheuvel
2022-06-29 8:56 ` Sudeep Holla
2022-06-29 8:58 ` Ard Biesheuvel
2022-06-29 9:02 ` Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220628134738.xqj6gu5ngbsuql2f@bogus \
--to=sudeep.holla@arm.com \
--cc=ardb@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox