Commit a454ad15 authored by Omar Ramirez Luna's avatar Omar Ramirez Luna Committed by Greg Kroah-Hartman

staging: tidspbridge: add pud code

And fix the following warning for passing an incorrect
variable type.

../tiomap3430.c: In function 'user_va2_pa':
../tiomap3430.c:1555:
    warning: passing argument 1 of 'pmd_offset' from
    incompatible pointer type
arch/arm/include/asm/pgtable-2level.h:156:
    note: expected 'struct pud_t *' but argument is of
    type 'pmdval_t (*)[2]'

While at it, eliminate 'if' nesting to increase readability.
Signed-off-by: default avatarOmar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0e7e10fe
...@@ -1547,21 +1547,28 @@ static int bridge_brd_mem_un_map(struct bridge_dev_context *dev_ctxt, ...@@ -1547,21 +1547,28 @@ static int bridge_brd_mem_un_map(struct bridge_dev_context *dev_ctxt,
static u32 user_va2_pa(struct mm_struct *mm, u32 address) static u32 user_va2_pa(struct mm_struct *mm, u32 address)
{ {
pgd_t *pgd; pgd_t *pgd;
pud_t *pud;
pmd_t *pmd; pmd_t *pmd;
pte_t *ptep, pte; pte_t *ptep, pte;
pgd = pgd_offset(mm, address); pgd = pgd_offset(mm, address);
if (!(pgd_none(*pgd) || pgd_bad(*pgd))) { if (pgd_none(*pgd) || pgd_bad(*pgd))
pmd = pmd_offset(pgd, address); return 0;
if (!(pmd_none(*pmd) || pmd_bad(*pmd))) {
pud = pud_offset(pgd, address);
if (pud_none(*pud) || pud_bad(*pud))
return 0;
pmd = pmd_offset(pud, address);
if (pmd_none(*pmd) || pmd_bad(*pmd))
return 0;
ptep = pte_offset_map(pmd, address); ptep = pte_offset_map(pmd, address);
if (ptep) { if (ptep) {
pte = *ptep; pte = *ptep;
if (pte_present(pte)) if (pte_present(pte))
return pte & PAGE_MASK; return pte & PAGE_MASK;
} }
}
}
return 0; return 0;
} }
......
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