Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
[powerpc.git] / drivers / video / fbmem.c
index 78907a8..4ff853f 100644 (file)
@@ -78,24 +78,22 @@ EXPORT_SYMBOL(fb_get_color_depth);
 /*
  * Data padding functions.
  */
-void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
-                           u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
-                           u32 height)
+void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
 {
-       int i;
+       int i, j;
 
        for (i = height; i--; ) {
-               memcpy(dst, src, s_pitch);
+               /* s_pitch is a few bytes at the most, memcpy is suboptimal */
+               for (j = 0; j < s_pitch; j++)
+                       dst[j] = src[j];
                src += s_pitch;
                dst += d_pitch;
        }
 }
-EXPORT_SYMBOL(fb_sysmove_buf_aligned);
+EXPORT_SYMBOL(fb_pad_aligned_buffer);
 
-void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
-                             u8 *dst, u32 d_pitch, u8 *src, u32 idx,
-                             u32 height, u32 shift_high, u32 shift_low,
-                             u32 mod)
+void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height,
+                               u32 shift_high, u32 shift_low, u32 mod)
 {
        u8 mask = (u8) (0xfff << shift_high), tmp;
        int i, j;
@@ -122,7 +120,7 @@ void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
                dst += d_pitch;
        }
 }
-EXPORT_SYMBOL(fb_sysmove_buf_unaligned);
+EXPORT_SYMBOL(fb_pad_unaligned_buffer);
 
 /*
  * we need to lock this section since fb_cursor
@@ -630,7 +628,7 @@ fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
 int
 fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 {
-       int err;
+       int err, flags = info->flags;
 
        if (var->activate & FB_ACTIVATE_INV_MODE) {
                struct fb_videomode mode1, mode2;
@@ -684,7 +682,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
                            !list_empty(&info->modelist))
                                err = fb_add_videomode(&mode, &info->modelist);
 
-                       if (!err && info->flags & FBINFO_MISC_USEREVENT) {
+                       if (!err && (flags & FBINFO_MISC_USEREVENT)) {
                                struct fb_event event;
 
                                info->flags &= ~FBINFO_MISC_USEREVENT;
@@ -1038,7 +1036,7 @@ register_framebuffer(struct fb_info *fb_info)
                        fb_info->pixmap.size = FBPIXMAPSIZE;
                        fb_info->pixmap.buf_align = 1;
                        fb_info->pixmap.scan_align = 1;
-                       fb_info->pixmap.access_align = 4;
+                       fb_info->pixmap.access_align = 32;
                        fb_info->pixmap.flags = FB_PIXMAP_DEFAULT;
                }
        }       
@@ -1168,6 +1166,7 @@ static void __exit
 fbmem_exit(void)
 {
        class_destroy(fb_class);
+       unregister_chrdev(FB_MAJOR, "fb");
 }
 
 module_exit(fbmem_exit);