diff options
author | Omar Ramirez Luna <omar.ramirez@copitl.com> | 2012-06-29 13:49:17 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-06 16:17:01 -0700 |
commit | a454ad15e015526ca84f15460bf8a56fccfffeea (patch) | |
tree | 44aa1f9318f39c33f29635cddc61b273af8e7cf5 | |
parent | 0e7e10fe49213ba4e9dc8a74615b81dd8a57ba2a (diff) | |
download | linux-3.10-a454ad15e015526ca84f15460bf8a56fccfffeea.tar.gz linux-3.10-a454ad15e015526ca84f15460bf8a56fccfffeea.tar.bz2 linux-3.10-a454ad15e015526ca84f15460bf8a56fccfffeea.zip |
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: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/tidspbridge/core/tiomap3430.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 9cf29fcea11..f9609ce2c16 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c @@ -1547,20 +1547,27 @@ EXIT_LOOP: static u32 user_va2_pa(struct mm_struct *mm, u32 address) { pgd_t *pgd; + pud_t *pud; pmd_t *pmd; pte_t *ptep, pte; pgd = pgd_offset(mm, address); - if (!(pgd_none(*pgd) || pgd_bad(*pgd))) { - pmd = pmd_offset(pgd, address); - if (!(pmd_none(*pmd) || pmd_bad(*pmd))) { - ptep = pte_offset_map(pmd, address); - if (ptep) { - pte = *ptep; - if (pte_present(pte)) - return pte & PAGE_MASK; - } - } + if (pgd_none(*pgd) || pgd_bad(*pgd)) + return 0; + + 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); + if (ptep) { + pte = *ptep; + if (pte_present(pte)) + return pte & PAGE_MASK; } return 0; |