diff options
-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 |