Merge tag 'drm-misc-next-2019-12-16' of git://anongit.freedesktop.org/drm/drm-misc...
[linux-2.6-block.git] / drivers / video / fbdev / core / fbmem.c
index 6f6fc785b54535c8f48a64c873bcb7a942455899..0662b61fdb50fc99e9b3b6361a4da243fd9b2196 100644 (file)
@@ -1079,7 +1079,7 @@ EXPORT_SYMBOL(fb_blank);
 static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
                        unsigned long arg)
 {
-       struct fb_ops *fb;
+       const struct fb_ops *fb;
        struct fb_var_screeninfo var;
        struct fb_fix_screeninfo fix;
        struct fb_cmap cmap_from;
@@ -1292,7 +1292,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd,
                            unsigned long arg)
 {
        struct fb_info *info = file_fb_info(file);
-       struct fb_ops *fb;
+       const struct fb_ops *fb;
        long ret = -ENOIOCTLCMD;
 
        if (!info)
@@ -1332,16 +1332,23 @@ static int
 fb_mmap(struct file *file, struct vm_area_struct * vma)
 {
        struct fb_info *info = file_fb_info(file);
-       struct fb_ops *fb;
+       int (*fb_mmap_fn)(struct fb_info *info, struct vm_area_struct *vma);
        unsigned long mmio_pgoff;
        unsigned long start;
        u32 len;
 
        if (!info)
                return -ENODEV;
-       fb = info->fbops;
        mutex_lock(&info->mm_lock);
-       if (fb->fb_mmap) {
+
+       fb_mmap_fn = info->fbops->fb_mmap;
+
+#if IS_ENABLED(CONFIG_FB_DEFERRED_IO)
+       if (info->fbdefio)
+               fb_mmap_fn = fb_deferred_io_mmap;
+#endif
+
+       if (fb_mmap_fn) {
                int res;
 
                /*
@@ -1349,7 +1356,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
                 * SME protection is removed ahead of the call
                 */
                vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
-               res = fb->fb_mmap(info, vma);
+               res = fb_mmap_fn(info, vma);
                mutex_unlock(&info->mm_lock);
                return res;
        }
@@ -1673,7 +1680,7 @@ static void unbind_console(struct fb_info *fb_info)
        console_unlock();
 }
 
-void unlink_framebuffer(struct fb_info *fb_info)
+static void unlink_framebuffer(struct fb_info *fb_info)
 {
        int i;
 
@@ -1692,7 +1699,6 @@ void unlink_framebuffer(struct fb_info *fb_info)
 
        fb_info->dev = NULL;
 }
-EXPORT_SYMBOL(unlink_framebuffer);
 
 static void do_unregister_framebuffer(struct fb_info *fb_info)
 {