Commit 103461a8 authored by Russell King's avatar Russell King Committed by Russell King

[ARM] Simplify setup_mm_for_reboot()

No point checking what CPU architecture level we have each time
within the loop, so precompute the base PMD flags outside the
loop.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 08f4ffb3
...@@ -577,23 +577,23 @@ static void __init create_mapping(struct map_desc *md) ...@@ -577,23 +577,23 @@ static void __init create_mapping(struct map_desc *md)
*/ */
void setup_mm_for_reboot(char mode) void setup_mm_for_reboot(char mode)
{ {
unsigned long pmdval; unsigned long base_pmdval;
pgd_t *pgd; pgd_t *pgd;
pmd_t *pmd;
int i; int i;
int cpu_arch = cpu_architecture();
if (current->mm && current->mm->pgd) if (current->mm && current->mm->pgd)
pgd = current->mm->pgd; pgd = current->mm->pgd;
else else
pgd = init_mm.pgd; pgd = init_mm.pgd;
for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++) { base_pmdval = PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT;
pmdval = (i << PGDIR_SHIFT) | if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ)
PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | base_pmdval |= PMD_BIT4;
PMD_TYPE_SECT;
if (cpu_arch <= CPU_ARCH_ARMv5TEJ) for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) {
pmdval |= PMD_BIT4; unsigned long pmdval = (i << PGDIR_SHIFT) | base_pmdval;
pmd_t *pmd;
pmd = pmd_off(pgd, i << PGDIR_SHIFT); pmd = pmd_off(pgd, i << PGDIR_SHIFT);
pmd[0] = __pmd(pmdval); pmd[0] = __pmd(pmdval);
pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))); pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment