aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-09-01 09:51:59 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-09-01 09:51:59 -0400
commit103461a80c2f2dd95fe9a39a5decd984622c2a9e (patch)
tree01d0fa7bfa325cbbeec6ea484378355a18269444 /arch
parent08f4ffb3eb4ff23daf9c61bcd523940d43c2270c (diff)
[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: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mm/mm-armv.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index 8cb024aa88bd..3a81944d74ba 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -577,23 +577,23 @@ static void __init create_mapping(struct map_desc *md)
577 */ 577 */
578void setup_mm_for_reboot(char mode) 578void setup_mm_for_reboot(char mode)
579{ 579{
580 unsigned long pmdval; 580 unsigned long base_pmdval;
581 pgd_t *pgd; 581 pgd_t *pgd;
582 pmd_t *pmd;
583 int i; 582 int i;
584 int cpu_arch = cpu_architecture();
585 583
586 if (current->mm && current->mm->pgd) 584 if (current->mm && current->mm->pgd)
587 pgd = current->mm->pgd; 585 pgd = current->mm->pgd;
588 else 586 else
589 pgd = init_mm.pgd; 587 pgd = init_mm.pgd;
590 588
591 for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++) { 589 base_pmdval = PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT;
592 pmdval = (i << PGDIR_SHIFT) | 590 if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ)
593 PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | 591 base_pmdval |= PMD_BIT4;
594 PMD_TYPE_SECT; 592
595 if (cpu_arch <= CPU_ARCH_ARMv5TEJ) 593 for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) {
596 pmdval |= PMD_BIT4; 594 unsigned long pmdval = (i << PGDIR_SHIFT) | base_pmdval;
595 pmd_t *pmd;
596
597 pmd = pmd_off(pgd, i << PGDIR_SHIFT); 597 pmd = pmd_off(pgd, i << PGDIR_SHIFT);
598 pmd[0] = __pmd(pmdval); 598 pmd[0] = __pmd(pmdval);
599 pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))); 599 pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1)));