Skip to contentSkip to conversation

drm/exynos: use DIV_ROUND_CLOSEST to find the closest div

PATCH New Chanho Park 1 participant 1 message Feb 11, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/exynos: use DIV_ROUND_CLOSEST to find the closest div

From: Chanho Park <[email protected]>

This patch uses DIV_ROUND_CLOSEST instead of DIV_ROUND_UP The DIV_ROUND_CLOSEST can be used to find the closest integer value when we divide some integers.

Cc Inki Dae <[email protected]>
Cc Joonyoung Shim <[email protected]>
Cc Seung-Woo Kim <[email protected]>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -1
index 4fb2952..da97f93 100644
@@ -383,7 +383,7 @@ static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
 	}
 
 	/* Find the clock divider value that gets us closest to ideal_clk */
-	clkdiv = DIV_ROUND_UP(clk_get_rate(ctx->lcd_clk), ideal_clk);
+	clkdiv = DIV_ROUND_CLOSEST(clk_get_rate(ctx->lcd_clk), ideal_clk);
 
 	return (clkdiv < 0x100) ? clkdiv : 0xff;
 }
Signature · 1 line
2.5.0