On Wed, Aug 14, 2024 at 10:09:15AM -0300, Jason Gunthorpe wrote: > On Fri, Aug 09, 2024 at 12:08:58PM -0400, Peter Xu wrote: > > There're: > > > > - 8 archs (arc, arm64, include, mips, powerpc, s390, sh, x86) that > > support pte_pgprot(). > > > > - 2 archs (x86, sparc) that support pmd_pgprot(). > > > > - 1 arch (x86) that support pud_pgprot(). > > > > Always define them to be used in generic code, and then we don't need to > > fiddle with "#ifdef"s when doing so. > > > > Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> > > --- > > arch/arm64/include/asm/pgtable.h | 1 + > > arch/powerpc/include/asm/pgtable.h | 1 + > > arch/s390/include/asm/pgtable.h | 1 + > > arch/sparc/include/asm/pgtable_64.h | 1 + > > include/linux/pgtable.h | 12 ++++++++++++ > > 5 files changed, 16 insertions(+) > > Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > > > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > > index 7a4f5604be3f..b78cc4a6758b 100644 > > --- a/arch/arm64/include/asm/pgtable.h > > +++ b/arch/arm64/include/asm/pgtable.h > > @@ -384,6 +384,7 @@ static inline void __sync_cache_and_tags(pte_t pte, unsigned int nr_pages) > > /* > > * Select all bits except the pfn > > */ > > +#define pte_pgprot pte_pgprot > > static inline pgprot_t pte_pgprot(pte_t pte) > > { > > unsigned long pfn = pte_pfn(pte); > > Stylistically I've been putting the #defines after the function body, > I wonder if there is a common pattern.. Right, I see both happening in tree right now and I don't know which is better. Personally I preferred "before function" as it makes spell checks easy to match macro/func names, and also cscope indexes both macro and func, so a jump to any of them would make me look at the entry of func. I'll keep it as-is for now just to make it easy for me.. but please comment if we do have a preferred pattern the other way round, then I'll follow. Thanks, -- Peter Xu