mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
Merge "msm: kgsl: Remove 'fd' dependency to get dma_buf handle"
This commit is contained in:
commit
84ca266039
1 changed files with 4 additions and 20 deletions
|
|
@ -2583,15 +2583,6 @@ static int kgsl_setup_anon_useraddr(struct kgsl_pagetable *pagetable,
|
|||
}
|
||||
|
||||
#ifdef CONFIG_DMA_SHARED_BUFFER
|
||||
static int match_file(const void *p, struct file *file, unsigned int fd)
|
||||
{
|
||||
/*
|
||||
* We must return fd + 1 because iterate_fd stops searching on
|
||||
* non-zero return, but 0 is a valid fd.
|
||||
*/
|
||||
return (p == file) ? (fd + 1) : 0;
|
||||
}
|
||||
|
||||
static void _setup_cache_mode(struct kgsl_mem_entry *entry,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
|
|
@ -2628,8 +2619,6 @@ static int kgsl_setup_dmabuf_useraddr(struct kgsl_device *device,
|
|||
vma = find_vma(current->mm, hostptr);
|
||||
|
||||
if (vma && vma->vm_file) {
|
||||
int fd;
|
||||
|
||||
ret = check_vma_flags(vma, entry->memdesc.flags);
|
||||
if (ret) {
|
||||
up_read(¤t->mm->mmap_sem);
|
||||
|
|
@ -2645,15 +2634,10 @@ static int kgsl_setup_dmabuf_useraddr(struct kgsl_device *device,
|
|||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* Look for the fd that matches this the vma file */
|
||||
fd = iterate_fd(current->files, 0, match_file, vma->vm_file);
|
||||
if (fd != 0) {
|
||||
dmabuf = dma_buf_get(fd - 1);
|
||||
if (IS_ERR(dmabuf)) {
|
||||
up_read(¤t->mm->mmap_sem);
|
||||
return PTR_ERR(dmabuf);
|
||||
}
|
||||
}
|
||||
/* Take a refcount because dma_buf_put() decrements the refcount */
|
||||
get_file(vma->vm_file);
|
||||
|
||||
dmabuf = vma->vm_file->private_data;
|
||||
}
|
||||
|
||||
if (!dmabuf) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue