Skip to content

Commit

Permalink
imx/clk-pllv2: fix wrong do_div() usage
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nicolas Pitre authored and Stephen Boyd committed Nov 30, 2015
1 parent 741e96e commit 0d2681e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/clk/imx/clk-pllv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static unsigned long __clk_pllv2_recalc_rate(unsigned long parent_rate,
{
long mfi, mfn, mfd, pdf, ref_clk;
unsigned long dbl;
s64 temp;
u64 temp;

dbl = dp_ctl & MXC_PLL_DP_CTL_DPDCK0_2_EN;

Expand All @@ -98,8 +98,9 @@ static unsigned long __clk_pllv2_recalc_rate(unsigned long parent_rate,
temp = (u64) ref_clk * abs(mfn);
do_div(temp, mfd + 1);
if (mfn < 0)
temp = -temp;
temp = (ref_clk * mfi) + temp;
temp = (ref_clk * mfi) - temp;
else
temp = (ref_clk * mfi) + temp;

return temp;
}
Expand All @@ -126,7 +127,7 @@ static int __clk_pllv2_set_rate(unsigned long rate, unsigned long parent_rate,
{
u32 reg;
long mfi, pdf, mfn, mfd = 999999;
s64 temp64;
u64 temp64;
unsigned long quad_parent_rate;

quad_parent_rate = 4 * parent_rate;
Expand Down

0 comments on commit 0d2681e

Please sign in to comment.