Skip to content

Commit

Permalink
fbdev: Fix fb_find_nearest_mode refresh comparison
Browse files Browse the repository at this point in the history
Refresh rate nearness is not calculated or reset when nearest resolution
changes.

This patch resets the refresh rate differential measurement whenever a
new nearest resolution is discovered.  This fixes two error cases;
first, wherein the first mode's refresh rate differential is never
calculated and second, when the closest refresh rate from a previous
nearest resolution is erroneously preserved.

Signed-off-by: Andrew Kephart <andrew.kephart@alereon.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Andrew Kephart authored and Paul Mundt committed Dec 14, 2010
1 parent 6313e3c commit e504b84
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/video/modedb.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
abs(cmode->yres - mode->yres);
if (diff > d) {
diff = d;
diff_refresh = abs(cmode->refresh - mode->refresh);
best = cmode;
} else if (diff == d) {
d = abs(cmode->refresh - mode->refresh);
Expand Down

0 comments on commit e504b84

Please sign in to comment.