git: dcb0c54968db - main - LinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_page

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 07 Aug 2023 01:00:22 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=dcb0c54968db10d3c7619f16c4bcfa9284d50ea2

commit dcb0c54968db10d3c7619f16c4bcfa9284d50ea2
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-07-31 05:28:42 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-08-07 00:58:21 +0000

    LinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_page
    
    Rather than using the FreeBSD internal calls vtophys() and
    PHYS_TO_VM_PAGE() use the already existing LinuxKPI abstraction for
    this called virt_to_page().  This reduces the amount of compat code
    to maintain and will allow further work on struct [vm_]page.
    
    This should be a NOP.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 weeks
    Reviewed by:    markj
    Differential Revision: https://reviews.freebsd.org/D41257
---
 sys/compat/linuxkpi/common/src/linux_page.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
index cc45a77eadbe..e6c44e0368fc 100644
--- a/sys/compat/linuxkpi/common/src/linux_page.c
+++ b/sys/compat/linuxkpi/common/src/linux_page.c
@@ -138,7 +138,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order)
 		if (vaddr == 0)
 			return (NULL);
 
-		page = PHYS_TO_VM_PAGE(vtophys((void *)vaddr));
+		page = virt_to_page((void *)vaddr);
 
 		KASSERT(vaddr == (vm_offset_t)page_address(page),
 		    ("Page address mismatch"));
@@ -526,7 +526,7 @@ linuxkpi_page_frag_free(void *addr)
 {
 	vm_page_t page;
 
-	page = PHYS_TO_VM_PAGE(vtophys(addr));
+	page = virt_to_page(addr);
 	linux_free_pages(page, 0);
 }