]> err.no Git - linux-2.6/blobdiff - drivers/video/fbmem.c
Merge branch 'fixes' of git://git.linux-nfs.org/pub/linux/nfs-2.6
[linux-2.6] / drivers / video / fbmem.c
index 354711c84aaa87a8602d89276a329c15daf9676a..38c2e2558f5e34ac8285ca91253b204e9ae4cc51 100644 (file)
@@ -799,11 +799,11 @@ static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var,
 int
 fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 {
-       int err, flags = info->flags;
+       int flags = info->flags;
+       int ret = 0;
 
        if (var->activate & FB_ACTIVATE_INV_MODE) {
                struct fb_videomode mode1, mode2;
-               int ret = 0;
 
                fb_var_to_videomode(&mode1, var);
                fb_var_to_videomode(&mode2, &info->var);
@@ -821,7 +821,9 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
                if (!ret)
                    fb_delete_videomode(&mode1, &info->modelist);
 
-               return ret;
+
+               ret = (ret) ? -EINVAL : 0;
+               goto done;
        }
 
        if ((var->activate & FB_ACTIVATE_FORCE) ||
@@ -830,20 +832,21 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 
                if (!info->fbops->fb_check_var) {
                        *var = info->var;
-                       return 0;
+                       goto done;
                }
 
-               if ((err = info->fbops->fb_check_var(var, info)))
-                       return err;
+               ret = info->fbops->fb_check_var(var, info);
+
+               if (ret)
+                       goto done;
 
                if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
                        struct fb_videomode mode;
-                       int err = 0;
 
                        if (info->fbops->fb_get_caps) {
-                               err = fb_check_caps(info, var, activate);
+                               ret = fb_check_caps(info, var, activate);
 
-                               if (err)
+                               if (ret)
                                        goto done;
                        }
 
@@ -853,16 +856,14 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
                                info->fbops->fb_set_par(info);
 
                        fb_pan_display(info, &info->var);
-
                        fb_set_cmap(&info->cmap, info);
-
                        fb_var_to_videomode(&mode, &info->var);
 
                        if (info->modelist.prev && info->modelist.next &&
                            !list_empty(&info->modelist))
-                               err = fb_add_videomode(&mode, &info->modelist);
+                               ret = fb_add_videomode(&mode, &info->modelist);
 
-                       if (!err && (flags & FBINFO_MISC_USEREVENT)) {
+                       if (!ret && (flags & FBINFO_MISC_USEREVENT)) {
                                struct fb_event event;
                                int evnt = (activate & FB_ACTIVATE_ALL) ?
                                        FB_EVENT_MODE_CHANGE_ALL :
@@ -876,7 +877,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
        }
 
  done:
-       return 0;
+       return ret;
 }
 
 int
@@ -1235,6 +1236,10 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
        pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
 #elif defined(__arm__) || defined(__sh__) || defined(__m32r__)
        vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+#elif defined(__avr32__)
+       vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot)
+                                     & ~_PAGE_CACHABLE)
+                                    | (_PAGE_BUFFER | _PAGE_DIRTY));
 #elif defined(__ia64__)
        if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
                vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);