viafb: fix LCD hardware cursor regression
[pandora-kernel.git] / drivers / video / via / viafbdev.c
index 10d8c4b..a0004c1 100644 (file)
@@ -680,7 +680,7 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
                if (!viafb_gamma_table)
                        return -ENOMEM;
                if (copy_from_user(viafb_gamma_table, argp,
-                               sizeof(viafb_gamma_table))) {
+                               256 * sizeof(u32))) {
                        kfree(viafb_gamma_table);
                        return -EFAULT;
                }
@@ -694,7 +694,7 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
                        return -ENOMEM;
                viafb_get_gamma_table(viafb_gamma_table);
                if (copy_to_user(argp, viafb_gamma_table,
-                       sizeof(viafb_gamma_table))) {
+                       256 * sizeof(u32))) {
                        kfree(viafb_gamma_table);
                        return -EFAULT;
                }
@@ -872,7 +872,9 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
        if (info->flags & FBINFO_HWACCEL_DISABLED || info != viafbinfo)
                return -ENODEV;
 
-       if (chip_name == UNICHROME_CLE266 && viapar->iga_path == IGA2)
+       /* LCD ouput does not support hw cursors (at least on VN896) */
+       if ((chip_name == UNICHROME_CLE266 && viapar->iga_path == IGA2) ||
+               viafb_LCD_ON)
                return -ENODEV;
 
        viafb_show_hw_cursor(info, HW_Cursor_OFF);