diff options
author | Jungseung Lee <js07.lee@gmail.com> | 2014-11-29 03:02:11 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-12-03 17:00:05 +0100 |
commit | 4e802cfd74e6351cb937997996de9ca2e67df9f2 (patch) | |
tree | 247b20f6c8b42bf3dc5fc9aeaa0ff52af96f5e6c /arch/arm/mm/mmu.c | |
parent | ARM: 8237/1: fix flush_pfn_alias (diff) | |
download | linux-4e802cfd74e6351cb937997996de9ca2e67df9f2.tar.xz linux-4e802cfd74e6351cb937997996de9ca2e67df9f2.zip |
ARM: 8238/1: mm: Refine set_memory_* functions
set_memory_* functions have same implementation
except memory attribute.
This patch makes to use common function for these, and pull out
the functions into arch/arm/mm/pageattr.c like arm64 did.
It will reduce code size and enhance the readability.
Signed-off-by: Jungseung Lee <js07.lee@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r-- | arch/arm/mm/mmu.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index b590a4c92462..f86ce1a9f525 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -356,44 +356,6 @@ const struct mem_type *get_mem_type(unsigned int type) } EXPORT_SYMBOL(get_mem_type); -#define PTE_SET_FN(_name, pteop) \ -static int pte_set_##_name(pte_t *ptep, pgtable_t token, unsigned long addr, \ - void *data) \ -{ \ - pte_t pte = pteop(*ptep); \ -\ - set_pte_ext(ptep, pte, 0); \ - return 0; \ -} \ - -#define SET_MEMORY_FN(_name, callback) \ -int set_memory_##_name(unsigned long addr, int numpages) \ -{ \ - unsigned long start = addr; \ - unsigned long size = PAGE_SIZE*numpages; \ - unsigned end = start + size; \ -\ - if (start < MODULES_VADDR || start >= MODULES_END) \ - return -EINVAL;\ -\ - if (end < MODULES_VADDR || end >= MODULES_END) \ - return -EINVAL; \ -\ - apply_to_page_range(&init_mm, start, size, callback, NULL); \ - flush_tlb_kernel_range(start, end); \ - return 0;\ -} - -PTE_SET_FN(ro, pte_wrprotect) -PTE_SET_FN(rw, pte_mkwrite) -PTE_SET_FN(x, pte_mkexec) -PTE_SET_FN(nx, pte_mknexec) - -SET_MEMORY_FN(ro, pte_set_ro) -SET_MEMORY_FN(rw, pte_set_rw) -SET_MEMORY_FN(x, pte_set_x) -SET_MEMORY_FN(nx, pte_set_nx) - /* * Adjust the PMD section entries according to the CPU in use. */ |