static int acornfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
  unsigned long off, start;
  u32 len;

  off = vma->vm_pgoff << PAGE_SHIFT;

  start = info->fix.smem_start;
  len = PAGE_ALIGN(start & ~PAGE_MASK) + info->fix.smem_len;
  start &= PAGE_MASK;
  if ((vma->vm_end - vma->vm_start + off) > len)
    return -EINVAL;
  off += start;
  vma->vm_pgoff = off >> PAGE_SHIFT;

  vma->vm_flags |= VM_IO;

  vma->vm_page_prot = pgrot_writecombine(vma->vm_page_prot);

  if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
                         vma->vm_end - vma->vm_start,
                         vma->vm_page_prot))
    return -EAGAIN;
  return 0;
}