UBI: silence warning
[pandora-kernel.git] / drivers / video / s3fb.c
index 756fafb..7d53bc2 100644 (file)
@@ -400,11 +400,17 @@ static int s3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
        struct s3fb_info *par = info->par;
        int rv, mem, step;
+       u16 m, n, r;
 
        /* Find appropriate format */
        rv = svga_match_format (s3fb_formats, var, NULL);
-       if ((rv < 0) || ((par->chip == CHIP_988_VIRGE_VX) ? (rv == 7) : (rv == 6)))
-       {               /* 24bpp on VIRGE VX, 32bpp on others */
+
+       /* 32bpp mode is not supported on VIRGE VX,
+          24bpp is not supported on others */
+       if ((par->chip == CHIP_988_VIRGE_VX) ? (rv == 7) : (rv == 6))
+               rv = -EINVAL;
+
+       if (rv < 0) {
                printk(KERN_ERR "fb%d: unsupported mode requested\n", info->node);
                return rv;
        }
@@ -422,20 +428,26 @@ static int s3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
        /* Check whether have enough memory */
        mem = ((var->bits_per_pixel * var->xres_virtual) >> 3) * var->yres_virtual;
-       if (mem > info->screen_size)
-       {
+       if (mem > info->screen_size) {
                printk(KERN_ERR "fb%d: not enough framebuffer memory (%d kB requested , %d kB available)\n",
                        info->node, mem >> 10, (unsigned int) (info->screen_size >> 10));
                return -EINVAL;
        }
 
        rv = svga_check_timings (&s3_timing_regs, var, info->node);
-       if (rv < 0)
-       {
+       if (rv < 0) {
                printk(KERN_ERR "fb%d: invalid timings requested\n", info->node);
                return rv;
        }
 
+       rv = svga_compute_pll(&s3_pll, PICOS2KHZ(var->pixclock), &m, &n, &r,
+                               info->node);
+       if (rv < 0) {
+               printk(KERN_ERR "fb%d: invalid pixclock value requested\n",
+                       info->node);
+               return rv;
+       }
+
        return 0;
 }
 
@@ -796,23 +808,6 @@ static int s3fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
        return 0;
 }
 
-/* Get capabilities of accelerator based on the mode */
-
-static void s3fb_get_caps(struct fb_info *info, struct fb_blit_caps *caps,
-                         struct fb_var_screeninfo *var)
-{
-       if (var->bits_per_pixel == 0) {
-               /* can only support 256 8x16 bitmap */
-               caps->x = 1 << (8 - 1);
-               caps->y = 1 << (16 - 1);
-               caps->len = 256;
-       } else {
-               caps->x = ~(u32)0;
-               caps->y = ~(u32)0;
-               caps->len = ~(u32)0;
-       }
-}
-
 /* ------------------------------------------------------------------------- */
 
 /* Frame buffer operations */
@@ -829,7 +824,7 @@ static struct fb_ops s3fb_ops = {
        .fb_fillrect    = s3fb_fillrect,
        .fb_copyarea    = cfb_copyarea,
        .fb_imageblit   = s3fb_imageblit,
-       .fb_get_caps    = s3fb_get_caps,
+       .fb_get_caps    = svga_get_caps,
 };
 
 /* ------------------------------------------------------------------------- */