msm: kgsl: Remove support for mmap from the kgsl driver.

The mmap(2) functionality of kgsl is no longer used, and it had a
bug that would crash the kernel when mmap(2) was called with
"odd" parameters.  So we have removed the mmap functionality.
If for some reason in the future you want to resurrect this,
make sure memdesc is properly initialized in all paths through
the kgsl_mmap() routine.

Signed-off-by: Ken Sumrall <ken@android.com>
This commit is contained in:
Ken Sumrall 2010-07-22 17:36:52 -07:00 committed by Jon Benson
parent 031a7f7967
commit f248e15b5f

View File

@ -1029,52 +1029,10 @@ static long kgsl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
return result;
}
static int kgsl_mmap(struct file *file, struct vm_area_struct *vma)
{
int result;
struct kgsl_memdesc *memdesc = NULL;
unsigned long vma_size = vma->vm_end - vma->vm_start;
unsigned long vma_offset = vma->vm_pgoff << PAGE_SHIFT;
struct kgsl_device *device = NULL;
mutex_lock(&kgsl_driver.mutex);
device = &kgsl_driver.yamato_device;
/*allow yamato memstore to be mapped read only */
if (vma_offset == device->memstore.physaddr) {
if (vma->vm_flags & VM_WRITE) {
result = -EPERM;
goto done;
}
memdesc = &device->memstore;
}
if (memdesc->size != vma_size) {
KGSL_MEM_ERR("file %p bad size %ld, should be %d\n",
file, vma_size, memdesc->size);
result = -EINVAL;
goto done;
}
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
result = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
vma_size, vma->vm_page_prot);
if (result != 0) {
KGSL_MEM_ERR("remap_pfn_range returned %d\n",
result);
goto done;
}
done:
mutex_unlock(&kgsl_driver.mutex);
return result;
}
static struct file_operations kgsl_fops = {
.owner = THIS_MODULE,
.release = kgsl_release,
.open = kgsl_open,
.mmap = kgsl_mmap,
.unlocked_ioctl = kgsl_ioctl,
};