Re: [PATCH] auxdisplay/cfag12864bfb.c: Replace vm_insert_page

From: Miguel Ojeda
Date: Thu Sep 20 2018 - 17:26:39 EST


On Thu, Sep 20, 2018 at 10:23 PM, Souptick Joarder <jrdr.linux@xxxxxxxxx> wrote:
> There is a plan to remove vm_insert_page permanently
> and replace it with new API vmf_insert_page which will
> return vm_fault_t type. As part of it vm_insert_page
> is removed from this driver.

A link to the discussion/plan would be nice. The commit 1c8f422059ae5
("mm: change return type to vm_fault_t") explains a bit, but has a
broken link :( Googling for the stuff returns many of the patches, but
not the actual discussion...

> static int cfag12864bfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
> {
> - return vm_insert_page(vma, vma->vm_start,
> - virt_to_page(cfag12864b_buffer));
> + struct page *page;
> + unsigned long size = vma->vm_end - vma->vm_start;
> +
> + page = virt_to_page(cfag12864b_buffer);
> + return remap_pfn_range(vma, vma->vm_start, page_to_pfn(page),
> + size, vma->vm_page_prot);

I am out of the loop on these mm changes, so please indulge me, but:

* Why is there no documentation on vmf_insert_page() while
vm_insert_page() had it? (specially since it seems you want to remove
vm_insert_page()).

* Shouldn't we have a simple remap_page() or remap_kernel_page() to
fit this use case and avoid that dance? (another driver in auxdisplay
will require the same change, and I guess others in the kernel as
well).

Thanks!

Cheers,
Miguel