]> err.no Git - linux-2.6/commitdiff
[PATCH] fbdev: Convert a few drivers to use the fb_find_best_display helper
authorAntonino A. Daplas <adaplas@gmail.com>
Mon, 7 Nov 2005 09:00:55 +0000 (01:00 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:53:53 +0000 (07:53 -0800)
Convert i810fb, nvidiafb and savagefb to use the fb_find_best_display helper
when searching for the initial video mode.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/video/i810/i810_main.c
drivers/video/nvidia/nvidia.c
drivers/video/savage/savagefb_driver.c

index 4175b2d8513c9649d6d9fff0c511eeebc709239a..1d148c5a5a4b7914f3b462f91034dce88c2781e7 100644 (file)
@@ -1871,27 +1871,18 @@ static void __devinit i810fb_find_init_mode(struct fb_info *info)
        fb_videomode_to_modelist(specs->modedb, specs->modedb_len,
                                 &info->modelist);
        if (specs->modedb != NULL) {
-               if (xres && yres) {
-                       struct fb_videomode *m;
+               struct fb_videomode *m;
 
+               if (xres && yres) {
                        if ((m = fb_find_best_mode(&var, &info->modelist))) {
                                mode = *m;
                                found  = 1;
                        }
                }
 
-               if (!found && specs->misc & FB_MISC_1ST_DETAIL) {
-                       for (i = 0; i < specs->modedb_len; i++) {
-                               if (specs->modedb[i].flag & FB_MODE_IS_FIRST) {
-                                       mode = specs->modedb[i];
-                                       found = 1;
-                                       break;
-                               }
-                       }
-               }
-
                if (!found) {
-                       mode = specs->modedb[0];
+                       m = fb_find_best_display(&info->monspecs, &info->modelist);
+                       mode = *m;
                        found = 1;
                }
 
index cbe165bb181db374fb8c9c3ac60ae370d35d098d..0b40a2a721c180609c15b16e82e3209b195a846e 100644 (file)
@@ -1383,22 +1383,10 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
        fb_var_to_videomode(&modedb, &nvidiafb_default_var);
 
        if (specs->modedb != NULL) {
-               /* get preferred timing */
-               if (specs->misc & FB_MISC_1ST_DETAIL) {
-                       int i;
-
-                       for (i = 0; i < specs->modedb_len; i++) {
-                               if (specs->modedb[i].flag & FB_MODE_IS_FIRST) {
-                                       modedb = specs->modedb[i];
-                                       break;
-                               }
-                       }
-               } else {
-                       /* otherwise, get first mode in database */
-                       modedb = specs->modedb[0];
-               }
+               struct fb_videomode *modedb;
 
-               fb_videomode_to_var(&nvidiafb_default_var, &modedb);
+               modedb = fb_find_best_display(specs, &info->modelist);
+               fb_videomode_to_var(&nvidiafb_default_var, modedb);
                nvidiafb_default_var.bits_per_pixel = 8;
        } else if (par->fpWidth && par->fpHeight) {
                char buf[16];
index 06e989ba3d13752989caf7e1dc933e0edbcf187c..f0dfb35e3191b4637e76d085927f3e41dd76e5d0 100644 (file)
@@ -2052,24 +2052,11 @@ static int __devinit savagefb_probe (struct pci_dev* dev,
                             info->monspecs.modedb, info->monspecs.modedb_len,
                             NULL, 8);
        } else if (info->monspecs.modedb != NULL) {
-               struct fb_monspecs *specs = &info->monspecs;
-               struct fb_videomode modedb;
+               struct fb_videomode *modedb;
 
-               if (info->monspecs.misc & FB_MISC_1ST_DETAIL) {
-                       int i;
-
-                       for (i = 0; i < specs->modedb_len; i++) {
-                               if (specs->modedb[i].flag & FB_MODE_IS_FIRST) {
-                                       modedb = specs->modedb[i];
-                                       break;
-                               }
-                       }
-               } else {
-                       /* otherwise, get first mode in database */
-                       modedb = specs->modedb[0];
-               }
-
-               savage_update_var(&info->var, &modedb);
+               modedb = fb_find_best_display(&info->monspecs,
+                                             &info->modelist);
+               savage_update_var(&info->var, modedb);
        }
 
        /* maximize virtual vertical length */