]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: use helper for calling f_op->mmap()
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 20 Feb 2017 15:51:23 +0000 (16:51 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 20 Feb 2017 15:51:23 +0000 (16:51 +0100)
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
drivers/gpu/drm/i915/i915_gem_dmabuf.c
drivers/gpu/drm/vgem/vgem_drv.c
fs/coda/file.c
include/linux/fs.h
ipc/shm.c
mm/mmap.c
mm/nommu.c

index 5e38299b5df65387876843c7b83fe9327641af8c..84fc9f0015760014f88520372e494b643a65507b 100644 (file)
@@ -141,7 +141,7 @@ static int i915_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *
        if (!obj->base.filp)
                return -ENODEV;
 
-       ret = obj->base.filp->f_op->mmap(obj->base.filp, vma);
+       ret = call_mmap(obj->base.filp, vma);
        if (ret)
                return ret;
 
index 477e07f0ecb674e906994595e60a948e79896c30..9f7e222b3e89ce63dec27e7b721c27a877556f02 100644 (file)
@@ -287,7 +287,7 @@ static int vgem_prime_mmap(struct drm_gem_object *obj,
        if (!obj->filp)
                return -ENODEV;
 
-       ret = obj->filp->f_op->mmap(obj->filp, vma);
+       ret = call_mmap(obj->filp, vma);
        if (ret)
                return ret;
 
index 6e0154eb6fcc1c0c7163c18990a4e2e0a0e74368..9d956cd6d46f93e56b8274e8d5b913071b05bc49 100644 (file)
@@ -96,7 +96,7 @@ coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma)
        cfi->cfi_mapcount++;
        spin_unlock(&cii->c_lock);
 
-       return host_file->f_op->mmap(host_file, vma);
+       return call_mmap(host_file, vma);
 }
 
 int coda_open(struct inode *coda_inode, struct file *coda_file)
index a3145cdff8f261956033da3fc453ae478809188e..93691b59e476ac26f2ac0d347b0a53637c57c255 100644 (file)
@@ -1727,6 +1727,11 @@ static inline ssize_t call_write_iter(struct file *file, struct kiocb *kio,
        return file->f_op->write_iter(kio, iter);
 }
 
+static inline int call_mmap(struct file *file, struct vm_area_struct *vma)
+{
+       return file->f_op->mmap(file, vma);
+}
+
 ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
                              unsigned long nr_segs, unsigned long fast_segs,
                              struct iovec *fast_pointer,
index 81203e8ba013597895444a02cdd90c5798f70c34..4329fe3ef5948a434d8547d66f22bec403521bb0 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -423,7 +423,7 @@ static int shm_mmap(struct file *file, struct vm_area_struct *vma)
        if (ret)
                return ret;
 
-       ret = sfd->file->f_op->mmap(sfd->file, vma);
+       ret = call_mmap(sfd->file, vma);
        if (ret) {
                shm_close(vma);
                return ret;
index dc4291dcc99b8f245fe38aeb52bb5aa5fbe3243d..3714aa4e6f81603dcfbe71f7e4d536420260ed5d 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1668,7 +1668,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
                 * new file must not have been exposed to user-space, yet.
                 */
                vma->vm_file = get_file(file);
-               error = file->f_op->mmap(file, vma);
+               error = call_mmap(file, vma);
                if (error)
                        goto unmap_and_free_vma;
 
index 24f9f5f391459201f8c07c74f3afb931f716791b..e366354f777de1a2c61c438e76da9d41696b73bb 100644 (file)
@@ -1084,7 +1084,7 @@ static int do_mmap_shared_file(struct vm_area_struct *vma)
 {
        int ret;
 
-       ret = vma->vm_file->f_op->mmap(vma->vm_file, vma);
+       ret = call_mmap(vma->vm_file, vma);
        if (ret == 0) {
                vma->vm_region->vm_top = vma->vm_region->vm_end;
                return 0;
@@ -1115,7 +1115,7 @@ static int do_mmap_private(struct vm_area_struct *vma,
         * - VM_MAYSHARE will be set if it may attempt to share
         */
        if (capabilities & NOMMU_MAP_DIRECT) {
-               ret = vma->vm_file->f_op->mmap(vma->vm_file, vma);
+               ret = call_mmap(vma->vm_file, vma);
                if (ret == 0) {
                        /* shouldn't return success if we're not sharing */
                        BUG_ON(!(vma->vm_flags & VM_MAYSHARE));