summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-11-22 00:48:55 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-11-26 21:45:46 +0100
commit6e4beb5e682953212da48ebb9e5c90408b8d38ae (patch)
tree7db9b9ce44dee035c738c5b292235447987bc099
parentARM: pgtable: get rid of get_pgd_slow()/free_pgd_slow() (diff)
downloadlinux-6e4beb5e682953212da48ebb9e5c90408b8d38ae.tar.xz
linux-6e4beb5e682953212da48ebb9e5c90408b8d38ae.zip
ARM: pgtable: use pXd_none_or_clear_bad() in pgd_free()
Remove knowledge of the 2-level wrapping in pgd_free(), and use the pXd_none_or_clear_bad() macros when checking the entries. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mm/pgd.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c
index e3eda56f4788..d15785eb73a7 100644
--- a/arch/arm/mm/pgd.c
+++ b/arch/arm/mm/pgd.c
@@ -73,28 +73,29 @@ no_pgd:
return NULL;
}
-void pgd_free(struct mm_struct *mm, pgd_t *pgd)
+void pgd_free(struct mm_struct *mm, pgd_t *pgd_base)
{
+ pgd_t *pgd;
pmd_t *pmd;
pgtable_t pte;
- if (!pgd)
+ if (!pgd_base)
return;
- /* pgd is always present and good */
- pmd = pmd_off(pgd, 0);
- if (pmd_none(*pmd))
- goto free;
- if (pmd_bad(*pmd)) {
- pmd_ERROR(*pmd);
- pmd_clear(pmd);
- goto free;
- }
+ pgd = pgd_base + pgd_index(0);
+ if (pgd_none_or_clear_bad(pgd))
+ goto no_pgd;
+
+ pmd = pmd_offset(pgd, 0);
+ if (pmd_none_or_clear_bad(pmd))
+ goto no_pmd;
pte = pmd_pgtable(*pmd);
pmd_clear(pmd);
pte_free(mm, pte);
+no_pmd:
+ pgd_clear(pgd);
pmd_free(mm, pmd);
-free:
- free_pages((unsigned long) pgd, 2);
+no_pgd:
+ free_pages((unsigned long) pgd_base, 2);
}