Merge tag 'fbdev-v4.13' of git://github.com/bzolnier/linux
[sfrench/cifs-2.6.git] / drivers / video / fbdev / core / fbmem.c
index 069fe7960df1cedd17c3f7119d2ab6a6989e46c1..7a42238db446b0093323505b710963ac94a53e15 100644 (file)
@@ -1331,22 +1331,13 @@ static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix,
 static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
                              unsigned long arg)
 {
-       mm_segment_t old_fs;
        struct fb_fix_screeninfo fix;
-       struct fb_fix_screeninfo32 __user *fix32;
-       int err;
-
-       fix32 = compat_ptr(arg);
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       err = do_fb_ioctl(info, cmd, (unsigned long) &fix);
-       set_fs(old_fs);
 
-       if (!err)
-               err = do_fscreeninfo_to_user(&fix, fix32);
-
-       return err;
+       if (!lock_fb_info(info))
+               return -ENODEV;
+       fix = info->fix;
+       unlock_fb_info(info);
+       return do_fscreeninfo_to_user(&fix, compat_ptr(arg));
 }
 
 static long fb_compat_ioctl(struct file *file, unsigned int cmd,
@@ -1492,7 +1483,7 @@ __releases(&info->lock)
        return 0;
 }
 
-#ifdef CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA
+#if defined(CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA) && !defined(CONFIG_MMU)
 unsigned long get_fb_unmapped_area(struct file *filp,
                                   unsigned long addr, unsigned long len,
                                   unsigned long pgoff, unsigned long flags)
@@ -1519,7 +1510,8 @@ static const struct file_operations fb_fops = {
        .open =         fb_open,
        .release =      fb_release,
 #if defined(HAVE_ARCH_FB_UNMAPPED_AREA) || \
-    defined(CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA)
+       (defined(CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA) && \
+        !defined(CONFIG_MMU))
        .get_unmapped_area = get_fb_unmapped_area,
 #endif
 #ifdef CONFIG_FB_DEFERRED_IO