LoongArch: Move {dmw,tlb}_virt_to_page() definition to page.h
authorMax Kellermann <max.kellermann@ionos.com>
Tue, 19 Mar 2024 07:50:34 +0000 (15:50 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Tue, 19 Mar 2024 07:50:34 +0000 (15:50 +0800)
These two functions are implemented in pgtable.c, and they are needed
only by the virt_to_page() macro in page.h. Having the prototypes in
pgtable.h causes a circular dependency between page.h and pgtable.h,
because the virt_to_page() macro in page.h needs pgtable.h for these
two functions, while pgtable.h needs various definitions from page.h
(e.g. pte_t and pgt_t).

Let's avoid this circular dependency by moving the function prototypes
to page.h.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/page.h
arch/loongarch/include/asm/pgtable.h

index 63f137ce82a41fc4e251f2adceef441e72dcd691..2391fcd189087a2d70c5d6ebe512471f7e84a17e 100644 (file)
@@ -83,6 +83,9 @@ typedef struct { unsigned long pgprot; } pgprot_t;
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
 #define sym_to_pfn(x)          __phys_to_pfn(__pa_symbol(x))
 
+struct page *dmw_virt_to_page(unsigned long kaddr);
+struct page *tlb_virt_to_page(unsigned long kaddr);
+
 #define virt_to_pfn(kaddr)     PFN_DOWN(PHYSADDR(kaddr))
 
 #define virt_to_page(kaddr)                                                            \
index 8b5df1bbf9e9c21b09c04639c7ac5c4f3c8d4a4d..af3acdf3481a6a74cb4583a42c12362d44204bf2 100644 (file)
@@ -363,9 +363,6 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
 extern pgd_t swapper_pg_dir[];
 extern pgd_t invalid_pg_dir[];
 
-struct page *dmw_virt_to_page(unsigned long kaddr);
-struct page *tlb_virt_to_page(unsigned long kaddr);
-
 /*
  * The following only work if pte_present() is true.
  * Undefined behaviour if not..