From: Max Kellermann <max.kellermann@ionos.com>
To: chenhuacai@kernel.org, kernel@xen0n.name, lienze@kylinos.cn,
yangtiezhu@loongson.cn, tglx@linutronix.de, arnd@arndb.de,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH] loongarch/pgtable.h: move {dmw,tlb}_virt_to_page() to page.h
Date: Fri, 8 Mar 2024 08:46:00 +0100 [thread overview]
Message-ID: <20240308074600.3294338-1-max.kellermann@ionos.com> (raw)
These functions are implemented in pgtable.c, and they are needed only
by the virt_to_pfn() macro in page.h. Having the prototypes in
pgtable.h causes a circular dependency between page.h and pgtable.h,
because page.h's virt_to_pfn() needs pgtable.h for these two
functions, and pgtable.h needs various definitions from page.h
(e.g. pte_t and pgt_t).
I suggest avoiding this circular dependency by moving the function
prototypes to page.h, even though that is slightly incorrect, because
they are not implemented in page.c but pgtable.c, but it's the
simplest possible solution to this problem and the functions not used
anywhere else.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
arch/loongarch/include/asm/page.h | 3 +++
arch/loongarch/include/asm/pgtable.h | 3 ---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/loongarch/include/asm/page.h b/arch/loongarch/include/asm/page.h
index afb6fa16b826..44027060c54a 100644
--- a/arch/loongarch/include/asm/page.h
+++ b/arch/loongarch/include/asm/page.h
@@ -75,6 +75,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) \
diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
index 8b5df1bbf9e9..af3acdf3481a 100644
--- a/arch/loongarch/include/asm/pgtable.h
+++ b/arch/loongarch/include/asm/pgtable.h
@@ -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..
--
2.39.2
next reply other threads:[~2024-03-08 7:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 7:46 Max Kellermann [this message]
2024-03-10 1:14 ` Huacai Chen
2024-03-10 10:22 ` Max Kellermann
2024-03-10 14:03 ` Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240308074600.3294338-1-max.kellermann@ionos.com \
--to=max.kellermann@ionos.com \
--cc=arnd@arndb.de \
--cc=chenhuacai@kernel.org \
--cc=kernel@xen0n.name \
--cc=lienze@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=tglx@linutronix.de \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®