From: Shawn Guo <shawnguo@kernel.org>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Sascha Hauer <kernel@pengutronix.de>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
linux-clk@vger.kernel.org
Subject: Re: [PATCH] imx/clk-pllv1: fix wrong do_div() usage
Date: Mon, 23 Nov 2015 13:56:25 +0800 [thread overview]
Message-ID: <20151123055625.GI13744@tiger> (raw)
In-Reply-To: <alpine.LFD.2.20.1511031941300.630@knanqh.ubzr>
Added Stephen.
On Tue, Nov 03, 2015 at 07:46:23PM -0500, Nicolas Pitre wrote:
> 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>
Mike, Stephen,
Can you please apply it for v4.4-rc? Or I will queue it for v4.5-rc1.
Shawn
>
> diff --git a/drivers/clk/imx/clk-pllv1.c b/drivers/clk/imx/clk-pllv1.c
> index 8564e4342c..82fe3662b5 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 = {
>
>
next prev parent reply other threads:[~2015-11-23 5:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-04 0:46 [PATCH] imx/clk-pllv1: fix wrong do_div() usage Nicolas Pitre
2015-11-23 5:56 ` Shawn Guo [this message]
2015-11-30 20:59 ` Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151123055625.GI13744@tiger \
--to=shawnguo@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-clk@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=nicolas.pitre@linaro.org \
--cc=sboyd@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.