mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-19 21:44:08 +00:00
arm64: mm: Simplify definition of virt_addr_valid()
_virt_addr_valid() is defined as the same value in two places and rolls its own version of virt_to_pfn() in both cases. Consolidate these definitions by inlining a simplified version directly into virt_addr_valid(). Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
d2c68de192
commit
d2d73d2fef
1 changed files with 2 additions and 4 deletions
|
@ -312,7 +312,6 @@ static inline void *phys_to_virt(phys_addr_t x)
|
|||
|
||||
#if !defined(CONFIG_SPARSEMEM_VMEMMAP) || defined(CONFIG_DEBUG_VIRTUAL)
|
||||
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
|
||||
#define _virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
|
||||
#else
|
||||
#define __virt_to_pgoff(kaddr) (((u64)(kaddr) - PAGE_OFFSET) / PAGE_SIZE * sizeof(struct page))
|
||||
#define __page_to_voff(kaddr) (((u64)(kaddr) - VMEMMAP_START) * PAGE_SIZE / sizeof(struct page))
|
||||
|
@ -326,15 +325,14 @@ static inline void *phys_to_virt(phys_addr_t x)
|
|||
})
|
||||
|
||||
#define virt_to_page(vaddr) ((struct page *)((__virt_to_pgoff(vaddr)) + VMEMMAP_START))
|
||||
|
||||
#define _virt_addr_valid(kaddr) pfn_valid(__virt_to_phys((u64)(kaddr)) >> PAGE_SHIFT)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _virt_addr_is_linear(kaddr) \
|
||||
(__tag_reset((u64)(kaddr)) >= PAGE_OFFSET)
|
||||
|
||||
#define virt_addr_valid(kaddr) \
|
||||
(_virt_addr_is_linear(kaddr) && _virt_addr_valid(kaddr))
|
||||
(_virt_addr_is_linear(kaddr) && pfn_valid(virt_to_pfn(kaddr)))
|
||||
|
||||
/*
|
||||
* Given that the GIC architecture permits ITS implementations that can only be
|
||||
|
|
Loading…
Add table
Reference in a new issue