Skip to content

Commit f1dabbe

Browse files
tombarobertfoss
authored andcommitted
drm/bridge: tc358768: Fix tc358768_ns_to_cnt()
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: ff1ca63 ("drm/bridge: Add tc358768 driver") Reviewed-by: Peter Ujfalusi <peter.ujfalusi@gmail.com> Tested-by: Maxim Schwalm <maxim.schwalm@gmail.com> # Asus TF700T Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Robert Foss <rfoss@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230906-tc358768-v4-11-31725f008a50@ideasonboard.com
1 parent b3aa7b3 commit f1dabbe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/bridge/tc358768.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static int tc358768_setup_pll(struct tc358768_priv *priv,
630630

631631
static u32 tc358768_ns_to_cnt(u32 ns, u32 period_ps)
632632
{
633-
return (ns * 1000 + period_ps) / period_ps;
633+
return DIV_ROUND_UP(ns * 1000, period_ps);
634634
}
635635

636636
static u32 tc358768_ps_to_ns(u32 ps)

0 commit comments

Comments
 (0)