diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-01-16 11:45:26 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-01-16 11:45:26 -0500 |
commit | 78bf04fc96f509474c6b443b515d6b79bb7bf584 (patch) | |
tree | 0c1789dadfeba2ec649c3051a0e5e481ce6fbc56 /arch/sh/mm | |
parent | 597fe76ec36e782aa45b8dac5e12e4dbb0588967 (diff) |
sh: Tidy up non-translatable checks in iounmap path.
This tidies up the iounmap path with consolidated checks for
nontranslatable mappings. This is in preparation of unifying
the implementations.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r-- | arch/sh/mm/ioremap_32.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/arch/sh/mm/ioremap_32.c b/arch/sh/mm/ioremap_32.c index 2141befb4f91..c80a8166fbb0 100644 --- a/arch/sh/mm/ioremap_32.c +++ b/arch/sh/mm/ioremap_32.c | |||
@@ -105,15 +105,35 @@ void __iomem *__ioremap_caller(unsigned long phys_addr, unsigned long size, | |||
105 | } | 105 | } |
106 | EXPORT_SYMBOL(__ioremap_caller); | 106 | EXPORT_SYMBOL(__ioremap_caller); |
107 | 107 | ||
108 | /* | ||
109 | * Simple checks for non-translatable mappings. | ||
110 | */ | ||
111 | static inline int iomapping_nontranslatable(unsigned long offset) | ||
112 | { | ||
113 | #ifdef CONFIG_29BIT | ||
114 | /* | ||
115 | * In 29-bit mode this includes the fixed P1/P2 areas, as well as | ||
116 | * parts of P3. | ||
117 | */ | ||
118 | if (PXSEG(offset) < P3SEG || offset >= P3_ADDR_MAX) | ||
119 | return 1; | ||
120 | #endif | ||
121 | |||
122 | if (is_pci_memory_fixed_range(offset, 0)) | ||
123 | return 1; | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
108 | void __iounmap(void __iomem *addr) | 128 | void __iounmap(void __iomem *addr) |
109 | { | 129 | { |
110 | unsigned long vaddr = (unsigned long __force)addr; | 130 | unsigned long vaddr = (unsigned long __force)addr; |
111 | unsigned long seg = PXSEG(vaddr); | ||
112 | struct vm_struct *p; | 131 | struct vm_struct *p; |
113 | 132 | ||
114 | if (seg < P3SEG || vaddr >= P3_ADDR_MAX) | 133 | /* |
115 | return; | 134 | * Nothing to do if there is no translatable mapping. |
116 | if (is_pci_memory_fixed_range(vaddr, 0)) | 135 | */ |
136 | if (iomapping_nontranslatable(vaddr)) | ||
117 | return; | 137 | return; |
118 | 138 | ||
119 | #ifdef CONFIG_PMB | 139 | #ifdef CONFIG_PMB |