From: Laurent Pinchart Date: Mon, 23 Apr 2012 12:59:25 +0000 (-0300) Subject: [media] v4l: aptina-pll: Round up minimum multiplier factor value properly X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=31ed29f9812a9cb9a1c6d270ff4e19da60046da1;p=openwrt%2Fstaging%2Fblogic.git [media] v4l: aptina-pll: Round up minimum multiplier factor value properly The mf_low value must be a multiple of mf_inc. Round it up to the nearest mf_inc multiple after computing it. Signed-off-by: Laurent Pinchart Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/aptina-pll.c b/drivers/media/video/aptina-pll.c index 0bd3813bb59d..8153a449846b 100644 --- a/drivers/media/video/aptina-pll.c +++ b/drivers/media/video/aptina-pll.c @@ -148,9 +148,8 @@ int aptina_pll_calculate(struct device *dev, unsigned int mf_high; unsigned int mf_low; - mf_low = max(roundup(mf_min, mf_inc), - DIV_ROUND_UP(pll->ext_clock * p1, - limits->int_clock_max * div)); + mf_low = roundup(max(mf_min, DIV_ROUND_UP(pll->ext_clock * p1, + limits->int_clock_max * div)), mf_inc); mf_high = min(mf_max, pll->ext_clock * p1 / (limits->int_clock_min * div));