mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
fbdev/vermillion: use vm_iomap_memory()
Use vm_iomap_memory() instead of [io_]remap_pfn_range(). vm_iomap_memory() gives us much simpler API to map memory to userspace, and reduces possibilities for bugs. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Alan Hourihane <alanh@fairlite.demon.co.uk>
This commit is contained in:
parent
51fc8e8aab
commit
5171774382
1 changed files with 4 additions and 10 deletions
|
@ -1003,24 +1003,18 @@ static int vmlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
|
||||||
static int vmlfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
|
static int vmlfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
struct vml_info *vinfo = container_of(info, struct vml_info, info);
|
struct vml_info *vinfo = container_of(info, struct vml_info, info);
|
||||||
unsigned long size = vma->vm_end - vma->vm_start;
|
|
||||||
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
|
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
|
|
||||||
return -EINVAL;
|
|
||||||
if (offset + size > vinfo->vram_contig_size)
|
|
||||||
return -EINVAL;
|
|
||||||
ret = vmlfb_vram_offset(vinfo, offset);
|
ret = vmlfb_vram_offset(vinfo, offset);
|
||||||
if (ret)
|
if (ret)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
offset += vinfo->vram_start;
|
|
||||||
pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
|
pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
|
||||||
pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
|
pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
|
||||||
if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT,
|
|
||||||
size, vma->vm_page_prot))
|
return vm_iomap_memory(vma, vinfo->vram_start,
|
||||||
return -EAGAIN;
|
vinfo->vram_contig_size);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vmlfb_sync(struct fb_info *info)
|
static int vmlfb_sync(struct fb_info *info)
|
||||||
|
|
Loading…
Reference in a new issue