summaryrefslogtreecommitdiffstats
path: root/arch/m68k/include/asm/page_mm.h
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2022-06-02 09:48:29 +0200
committerLinus Walleij <linus.walleij@linaro.org>2023-05-29 11:27:08 +0200
commitef7d0f5d03b9e65c9daa8dfe8b405b10566055eb (patch)
treeecfcb0253a7ad6ca5f9f34240cd204a0d8f805bb /arch/m68k/include/asm/page_mm.h
parentarm64: memory: Make virt_to_pfn() a static inline (diff)
downloadlinux-ef7d0f5d03b9e65c9daa8dfe8b405b10566055eb.tar.xz
linux-ef7d0f5d03b9e65c9daa8dfe8b405b10566055eb.zip
m68k/mm: Make pfn accessors static inlines
Making virt_to_pfn() a static inline taking a strongly typed (const void *) makes the contract of a passing a pointer of that type to the function explicit and exposes any misuse of the macro virt_to_pfn() acting polymorphic and accepting many types such as (void *), (unitptr_t) or (unsigned long) as arguments without warnings. For symmetry, do the same with pfn_to_virt(). Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/m68k/include/asm/page_mm.h')
-rw-r--r--arch/m68k/include/asm/page_mm.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h
index 3903db2e8da7..363aa0f9ba8a 100644
--- a/arch/m68k/include/asm/page_mm.h
+++ b/arch/m68k/include/asm/page_mm.h
@@ -121,8 +121,15 @@ static inline void *__va(unsigned long x)
* TODO: implement (fast) pfn<->pgdat_idx conversion functions, this makes lots
* of the shifts unnecessary.
*/
-#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
-#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
+static inline unsigned long virt_to_pfn(const void *kaddr)
+{
+ return __pa(kaddr) >> PAGE_SHIFT;
+}
+
+static inline void *pfn_to_virt(unsigned long pfn)
+{
+ return __va(pfn << PAGE_SHIFT);
+}
extern int m68k_virt_to_node_shift;