Skip to content

Commit 3391538

Browse files
yanzhao56arndb
authored andcommitted
mm: Remove broken pfn_to_virt() on arch csky/hexagon/openrisc
Remove the broken pfn_to_virt() on architectures csky/hexagon/openrisc. The pfn_to_virt() on those architectures takes PFN instead of PA as the input to macro __va(), with PAGE_SHIFT applying to the converted VA, which is not right, especially when there's a non-zero offset in __va(). [1] The broken pfn_to_virt() was noticed when checking how page_to_virt() is unfolded on x86. It turns out that the one in linux/mm.h instead of in asm-generic/page.h is compiled for x86. However, page_to_virt() in asm-generic/page.h is found out expanding to pfn_to_virt() with a bug described above. The pfn_to_virt() is found out not right as well on architectures csky/hexagon/openrisc. Since there's no single caller on csky/hexagon/openrisc to pfn_to_virt() and there are functions doing similar things as pfn_to_virt() -- - pfn_to_kaddr() in asm/page.h for csky, - page_to_virt() in asm/page.h for hexagon, and - page_to_virt() in linux/mm.h for openrisc, just delete the pfn_to_virt() on those architectures. The pfn_to_virt() in asm-generic/page.h is not touched in this patch as it's referenced by page_to_virt() in that header while the whole header is going to be removed as a whole due to no one including it. Link:https://lore.kernel.org/all/[email protected] [1] Cc: Linus Walleij <[email protected]> Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Yan Zhao <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent b401b62 commit 3391538

File tree

3 files changed

+0
-16
lines changed

3 files changed

+0
-16
lines changed

arch/csky/include/asm/page.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ static inline unsigned long virt_to_pfn(const void *kaddr)
8282
return __pa(kaddr) >> PAGE_SHIFT;
8383
}
8484

85-
static inline void * pfn_to_virt(unsigned long pfn)
86-
{
87-
return (void *)((unsigned long)__va(pfn) << PAGE_SHIFT);
88-
}
89-
9085
#define MAP_NR(x) PFN_DOWN((unsigned long)(x) - PAGE_OFFSET - \
9186
PHYS_OFFSET_OFFSET)
9287
#define virt_to_page(x) (mem_map + MAP_NR(x))

arch/hexagon/include/asm/page.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,6 @@ static inline unsigned long virt_to_pfn(const void *kaddr)
133133
return __pa(kaddr) >> PAGE_SHIFT;
134134
}
135135

136-
static inline void *pfn_to_virt(unsigned long pfn)
137-
{
138-
return (void *)((unsigned long)__va(pfn) << PAGE_SHIFT);
139-
}
140-
141-
142136
#define page_to_virt(page) __va(page_to_phys(page))
143137

144138
#include <asm/mem-layout.h>

arch/openrisc/include/asm/page.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ static inline unsigned long virt_to_pfn(const void *kaddr)
7777
return __pa(kaddr) >> PAGE_SHIFT;
7878
}
7979

80-
static inline void * pfn_to_virt(unsigned long pfn)
81-
{
82-
return (void *)((unsigned long)__va(pfn) << PAGE_SHIFT);
83-
}
84-
8580
#define virt_to_page(addr) \
8681
(mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
8782

0 commit comments

Comments
 (0)