mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
asm-generic: provide generic page_to_phys and phys_to_page implementations
page_to_phys is duplicated by all architectures, and from some strange reason placed in <asm/io.h> where it doesn't fit at all. phys_to_page is only provided by a few architectures despite having a lot of open coded users. Provide generic versions in <asm-generic/memory_model.h> to make these helpers more easily usable. Note with this patch powerpc loses the CONFIG_DEBUG_VIRTUAL pfn_valid check. It will be added back in a generic version later. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
committed by
Arnd Bergmann
parent
6f043e7574
commit
c5c3238d9b
@@ -245,9 +245,7 @@ static inline unsigned long __phys_addr(unsigned long x, bool is_31bit)
|
||||
#define phys_to_pfn(phys) ((phys) >> PAGE_SHIFT)
|
||||
#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
|
||||
|
||||
#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
|
||||
#define phys_to_folio(phys) page_folio(phys_to_page(phys))
|
||||
#define page_to_phys(page) pfn_to_phys(page_to_pfn(page))
|
||||
#define folio_to_phys(page) pfn_to_phys(folio_pfn(folio))
|
||||
|
||||
static inline void *pfn_to_virt(unsigned long pfn)
|
||||
|
||||
Reference in New Issue
Block a user