]> Git Repo - linux.git/commitdiff
drm/bridge: tc358768: Fix tc358768_ns_to_cnt()
authorTomi Valkeinen <[email protected]>
Wed, 6 Sep 2023 06:50:58 +0000 (09:50 +0300)
committerRobert Foss <[email protected]>
Wed, 20 Sep 2023 11:48:47 +0000 (13:48 +0200)
The tc358768_ns_to_cnt() is, most likely, supposed to do a div-round-up
operation, but it misses subtracting one from the dividend.

Fix this by just using DIV_ROUND_UP().

Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver")
Reviewed-by: Peter Ujfalusi <[email protected]>
Tested-by: Maxim Schwalm <[email protected]> # Asus TF700T
Tested-by: Marcel Ziswiler <[email protected]>
Signed-off-by: Tomi Valkeinen <[email protected]>
Signed-off-by: Robert Foss <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/bridge/tc358768.c

index 9ce8d120b50cd2d3a1025029c10844d4fb2f4225..f41bf56b7d6b72d0cb890a8db71f1918269e66ce 100644 (file)
@@ -630,7 +630,7 @@ static int tc358768_setup_pll(struct tc358768_priv *priv,
 
 static u32 tc358768_ns_to_cnt(u32 ns, u32 period_ps)
 {
-       return (ns * 1000 + period_ps) / period_ps;
+       return DIV_ROUND_UP(ns * 1000, period_ps);
 }
 
 static u32 tc358768_ps_to_ns(u32 ps)
This page took 0.046138 seconds and 4 git commands to generate.