From: Andrew Kephart Date: Mon, 13 Dec 2010 15:46:34 +0000 (-0600) Subject: fbdev: Fix fb_find_nearest_mode refresh comparison X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e504b84805c574cf18d705c610c9e4a8f6e61017;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git fbdev: Fix fb_find_nearest_mode refresh comparison 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 Signed-off-by: Paul Mundt --- diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 0a4dbdc1693a..de450c1fb869 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -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);