[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9w3LL8oZixBKM3t@infradead.org>
Date: Thu, 20 Mar 2025 08:41:32 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Yunhui Cui <cuiyunhui@...edance.com>
Cc: paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
alex@...ti.fr, anshuman.khandual@....com, akpm@...ux-foundation.org,
mingo@...nel.org, catalin.marinas@....com, ryan.roberts@....com,
kirill.shutemov@...ux.intel.com, namcao@...utronix.de,
bjorn@...osinc.com, arnd@...db.de, stuart.menefy@...asip.com,
luxu.kernel@...edance.com, vincenzo.frascino@....com,
samuel.holland@...ive.com, christophe.leroy@...roup.eu,
dawei.li@...ngroup.cn, rppt@...nel.org,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] riscv: introduce the ioremap_prot() function
> +{
> + phys_addr_t addr = PFN_PHYS(pfn);
> +
> + /* avoid false positives for bogus PFNs, see comment in pfn_valid() */
> + if (PHYS_PFN(addr) != pfn)
> + return 0;
> +
> + return memblock_is_map_memory(addr);
> +}
> +EXPORT_SYMBOL(pfn_is_map_memory);
This should not be exported or even exposed. Please just open code it
in the only caller.
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> + pgprot_t pgprot)
> +{
> + /* Don't allow RAM to be mapped. */
> + if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr))))
> + return NULL;
Or just use pfn_valid as that's what we usually use for that check.
Or am I missing something specific here?
It would also be nice to just life this to common code.
Powered by blists - more mailing lists