Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ptdesc: remove ptdesc_to_virt()

This has the same effect as ptdesc_address() so convert the callers to use
that and delete the function. Add kernel-doc for ptdesc_address().

Link: https://lkml.kernel.org/r/20250908171104.2409217-4-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
90ec2df9 f0c92726

+10 -9
+1 -1
arch/arm/mm/mmu.c
··· 737 737 738 738 if (!ptdesc || !pagetable_pte_ctor(NULL, ptdesc)) 739 739 BUG(); 740 - return ptdesc_to_virt(ptdesc); 740 + return ptdesc_address(ptdesc); 741 741 } 742 742 743 743 static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr,
+3 -3
arch/s390/mm/pgalloc.c
··· 21 21 22 22 if (!ptdesc) 23 23 return NULL; 24 - table = ptdesc_to_virt(ptdesc); 24 + table = ptdesc_address(ptdesc); 25 25 __arch_set_page_dat(table, 1UL << CRST_ALLOC_ORDER); 26 26 return table; 27 27 } ··· 119 119 120 120 ptdesc = pagetable_alloc(GFP_KERNEL, 0); 121 121 if (ptdesc) { 122 - table = (u64 *)ptdesc_to_virt(ptdesc); 122 + table = (u64 *)ptdesc_address(ptdesc); 123 123 __arch_set_page_dat(table, 1); 124 124 memset64(table, _PAGE_INVALID, PTRS_PER_PTE); 125 125 memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE); ··· 146 146 pagetable_free(ptdesc); 147 147 return NULL; 148 148 } 149 - table = ptdesc_to_virt(ptdesc); 149 + table = ptdesc_address(ptdesc); 150 150 __arch_set_page_dat(table, 1); 151 151 memset64((u64 *)table, _PAGE_INVALID, PTRS_PER_PTE); 152 152 memset64((u64 *)table + PTRS_PER_PTE, 0, PTRS_PER_PTE);
+6 -5
include/linux/mm.h
··· 2944 2944 return page_ptdesc(virt_to_page(x)); 2945 2945 } 2946 2946 2947 - static inline void *ptdesc_to_virt(const struct ptdesc *pt) 2948 - { 2949 - return page_to_virt(ptdesc_page(pt)); 2950 - } 2951 - 2947 + /** 2948 + * ptdesc_address - Virtual address of page table. 2949 + * @pt: Page table descriptor. 2950 + * 2951 + * Return: The first byte of the page table described by @pt. 2952 + */ 2952 2953 static inline void *ptdesc_address(const struct ptdesc *pt) 2953 2954 { 2954 2955 return folio_address(ptdesc_folio(pt));