s390/mm: cleanup phys_to_pfn() and friends
Make page, frame, virtual and physical address conversion macros more expressive by avoiding redundant definitions and defining new macros using existing ones. Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
5e674c308b
commit
014b020475
|
@ -161,20 +161,20 @@ static inline int devmem_is_allowed(unsigned long pfn)
|
|||
#define __pa(x) ((unsigned long)(x))
|
||||
#define __va(x) ((void *)(unsigned long)(x))
|
||||
|
||||
#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
|
||||
#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
|
||||
#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 page_to_phys(page) pfn_to_phys(page_to_pfn(page))
|
||||
|
||||
#define pfn_to_virt(pfn) __va(pfn_to_phys(pfn))
|
||||
#define virt_to_pfn(kaddr) (phys_to_pfn(__pa(kaddr)))
|
||||
#define pfn_to_kaddr(pfn) pfn_to_virt(pfn)
|
||||
|
||||
#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
|
||||
#define page_to_virt(page) pfn_to_virt(page_to_pfn(page))
|
||||
|
||||
#define phys_to_pfn(kaddr) ((kaddr) >> PAGE_SHIFT)
|
||||
#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
|
||||
|
||||
#define phys_to_page(kaddr) pfn_to_page(phys_to_pfn(kaddr))
|
||||
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
|
||||
|
||||
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
|
||||
#define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr))
|
||||
|
||||
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
|
||||
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
|
||||
|
|
Loading…
Reference in a new issue