summaryrefslogtreecommitdiffstats
path: root/drivers/clk/imx/clk-pllv1.c
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2015-11-04 01:46:23 +0100
committerStephen Boyd <sboyd@codeaurora.org>2015-11-30 21:58:35 +0100
commit741e96e8790cbd389d27e29bbf66de2c691fd775 (patch)
tree0549369ea96a147bc45fcd00b95f1f087445354f /drivers/clk/imx/clk-pllv1.c
parentMerge branch 'for-4.4-rc/ti-clk-fixes' of https://github.com/t-kristo/linux-p... (diff)
downloadlinux-741e96e8790cbd389d27e29bbf66de2c691fd775.tar.xz
linux-741e96e8790cbd389d27e29bbf66de2c691fd775.zip
imx/clk-pllv1: fix wrong do_div() usage
do_div() is meant to be used with an unsigned dividend. Signed-off-by: Nicolas Pitre <nico@linaro.org> Acked-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/imx/clk-pllv1.c')
-rw-r--r--drivers/clk/imx/clk-pllv1.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/clk/imx/clk-pllv1.c b/drivers/clk/imx/clk-pllv1.c
index 8564e4342c7d..82fe3662b5f6 100644
--- a/drivers/clk/imx/clk-pllv1.c
+++ b/drivers/clk/imx/clk-pllv1.c
@@ -52,7 +52,7 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct clk_pllv1 *pll = to_clk_pllv1(hw);
- long long ll;
+ unsigned long long ull;
int mfn_abs;
unsigned int mfi, mfn, mfd, pd;
u32 reg;
@@ -94,16 +94,16 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
rate = parent_rate * 2;
rate /= pd + 1;
- ll = (unsigned long long)rate * mfn_abs;
+ ull = (unsigned long long)rate * mfn_abs;
- do_div(ll, mfd + 1);
+ do_div(ull, mfd + 1);
if (mfn_is_negative(pll, mfn))
- ll = -ll;
+ ull = (rate * mfi) - ull;
+ else
+ ull = (rate * mfi) + ull;
- ll = (rate * mfi) + ll;
-
- return ll;
+ return ull;
}
static struct clk_ops clk_pllv1_ops = {