hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/nios2/mm/ioremap.c
....@@ -86,11 +86,15 @@
8686 if (address >= end)
8787 BUG();
8888 do {
89
+ p4d_t *p4d;
8990 pud_t *pud;
9091 pmd_t *pmd;
9192
9293 error = -ENOMEM;
93
- pud = pud_alloc(&init_mm, dir, address);
94
+ p4d = p4d_alloc(&init_mm, dir, address);
95
+ if (!p4d)
96
+ break;
97
+ pud = pud_alloc(&init_mm, p4d, address);
9498 if (!pud)
9599 break;
96100 pmd = pmd_alloc(&init_mm, pud, address);
....@@ -112,8 +116,7 @@
112116 /*
113117 * Map some physical address range into the kernel address space.
114118 */
115
-void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
116
- unsigned long cacheflag)
119
+void __iomem *ioremap(unsigned long phys_addr, unsigned long size)
117120 {
118121 struct vm_struct *area;
119122 unsigned long offset;
....@@ -144,8 +147,7 @@
144147 * CONFIG_NIOS2_IO_REGION_BASE
145148 */
146149 if (IS_MAPPABLE_UNCACHEABLE(phys_addr) &&
147
- IS_MAPPABLE_UNCACHEABLE(last_addr) &&
148
- !(cacheflag & _PAGE_CACHED))
150
+ IS_MAPPABLE_UNCACHEABLE(last_addr))
149151 return (void __iomem *)(CONFIG_NIOS2_IO_REGION_BASE + phys_addr);
150152
151153 /* Mappings have to be page-aligned */
....@@ -158,21 +160,20 @@
158160 if (!area)
159161 return NULL;
160162 addr = area->addr;
161
- if (remap_area_pages((unsigned long) addr, phys_addr, size,
162
- cacheflag)) {
163
+ if (remap_area_pages((unsigned long) addr, phys_addr, size, 0)) {
163164 vunmap(addr);
164165 return NULL;
165166 }
166167 return (void __iomem *) (offset + (char *)addr);
167168 }
168
-EXPORT_SYMBOL(__ioremap);
169
+EXPORT_SYMBOL(ioremap);
169170
170171 /*
171
- * __iounmap unmaps nearly everything, so be careful
172
+ * iounmap unmaps nearly everything, so be careful
172173 * it doesn't free currently pointer/page tables anymore but it
173174 * wasn't used anyway and might be added later.
174175 */
175
-void __iounmap(void __iomem *addr)
176
+void iounmap(void __iomem *addr)
176177 {
177178 struct vm_struct *p;
178179
....@@ -184,4 +185,4 @@
184185 pr_err("iounmap: bad address %p\n", addr);
185186 kfree(p);
186187 }
187
-EXPORT_SYMBOL(__iounmap);
188
+EXPORT_SYMBOL(iounmap);