Skip to content

Commit cb10c28

Browse files
Christoph Hellwigakpm00
authored andcommitted
mm: remove follow_pfn
Remove follow_pfn now that the last user is gone. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Fei Li <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Nathan Chancellor <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 1b265da commit cb10c28

File tree

3 files changed

+2
-57
lines changed

3 files changed

+2
-57
lines changed

include/linux/mm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,8 +2424,6 @@ int
24242424
copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma);
24252425
int follow_pte(struct mm_struct *mm, unsigned long address,
24262426
pte_t **ptepp, spinlock_t **ptlp);
2427-
int follow_pfn(struct vm_area_struct *vma, unsigned long address,
2428-
unsigned long *pfn);
24292427
int follow_phys(struct vm_area_struct *vma, unsigned long address,
24302428
unsigned int flags, unsigned long *prot, resource_size_t *phys);
24312429
int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,

mm/memory.c

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5884,8 +5884,8 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
58845884
* Only IO mappings and raw PFN mappings are allowed. The mmap semaphore
58855885
* should be taken for read.
58865886
*
5887-
* KVM uses this function. While it is arguably less bad than ``follow_pfn``,
5888-
* it is not a good general-purpose API.
5887+
* KVM uses this function. While it is arguably less bad than the historic
5888+
* ``follow_pfn``, it is not a good general-purpose API.
58895889
*
58905890
* Return: zero on success, -ve otherwise.
58915891
*/
@@ -5927,38 +5927,6 @@ int follow_pte(struct mm_struct *mm, unsigned long address,
59275927
}
59285928
EXPORT_SYMBOL_GPL(follow_pte);
59295929

5930-
/**
5931-
* follow_pfn - look up PFN at a user virtual address
5932-
* @vma: memory mapping
5933-
* @address: user virtual address
5934-
* @pfn: location to store found PFN
5935-
*
5936-
* Only IO mappings and raw PFN mappings are allowed.
5937-
*
5938-
* This function does not allow the caller to read the permissions
5939-
* of the PTE. Do not use it.
5940-
*
5941-
* Return: zero and the pfn at @pfn on success, -ve otherwise.
5942-
*/
5943-
int follow_pfn(struct vm_area_struct *vma, unsigned long address,
5944-
unsigned long *pfn)
5945-
{
5946-
int ret = -EINVAL;
5947-
spinlock_t *ptl;
5948-
pte_t *ptep;
5949-
5950-
if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
5951-
return ret;
5952-
5953-
ret = follow_pte(vma->vm_mm, address, &ptep, &ptl);
5954-
if (ret)
5955-
return ret;
5956-
*pfn = pte_pfn(ptep_get(ptep));
5957-
pte_unmap_unlock(ptep, ptl);
5958-
return 0;
5959-
}
5960-
EXPORT_SYMBOL(follow_pfn);
5961-
59625930
#ifdef CONFIG_HAVE_IOREMAP_PROT
59635931
int follow_phys(struct vm_area_struct *vma,
59645932
unsigned long address, unsigned int flags,

mm/nommu.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,27 +110,6 @@ unsigned int kobjsize(const void *objp)
110110
return page_size(page);
111111
}
112112

113-
/**
114-
* follow_pfn - look up PFN at a user virtual address
115-
* @vma: memory mapping
116-
* @address: user virtual address
117-
* @pfn: location to store found PFN
118-
*
119-
* Only IO mappings and raw PFN mappings are allowed.
120-
*
121-
* Returns zero and the pfn at @pfn on success, -ve otherwise.
122-
*/
123-
int follow_pfn(struct vm_area_struct *vma, unsigned long address,
124-
unsigned long *pfn)
125-
{
126-
if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
127-
return -EINVAL;
128-
129-
*pfn = address >> PAGE_SHIFT;
130-
return 0;
131-
}
132-
EXPORT_SYMBOL(follow_pfn);
133-
134113
void vfree(const void *addr)
135114
{
136115
kfree(addr);

0 commit comments

Comments
 (0)