[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdayi5PyH7bifvShWRgtZXsNh9o8vA1TGV8tTORngeO8Hw@mail.gmail.com>
Date: Mon, 14 Aug 2023 20:22:28 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Michael Ellerman <mpe@...erman.id.au>
Cc: Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Subject: Re: [PATCH] powerpc: Make virt_to_pfn() a static inline
On Mon, Aug 14, 2023 at 2:37 PM Michael Ellerman <mpe@...erman.id.au> wrote:
> > +static inline const void *pfn_to_kaddr(unsigned long pfn)
> > +{
> > + return (const void *)(((unsigned long)__va(pfn)) << PAGE_SHIFT);
>
> Any reason to do it this way rather than:
>
> + return __va(pfn << PAGE_SHIFT);
>
> Seems to be equivalent and much cleaner?
I was afraid of changing the semantic in the original macro
which converts to a virtual address before shifting, instead
of shifting first, but you're right, I'm too cautious. I'll propose
the elegant solution from you & Christophe instead!
Yours,
Linus Walleij
Powered by blists - more mailing lists