From: Prashant Gaikwad <pgaikwad@nvidia.com>
To: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Stephen Warren <swarren@nvidia.com>,
Mike Turquette <mturquette@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] clk: tegra: Implement locking for super clock
Date: Fri, 8 Feb 2013 10:51:31 +0530 [thread overview]
Message-ID: <51148B5B.1090701@nvidia.com> (raw)
In-Reply-To: <1360254261-23000-1-git-send-email-pdeschrijver@nvidia.com>
On Thursday 07 February 2013 09:54 PM, Peter De Schrijver wrote:
> Although tegra_clk_register_super_mux() has a lock parameter, the lock is not
> actually used by the code. Fixed with this patch.
>
> Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
> ---
> drivers/clk/tegra/clk-super.c | 18 +++++++++++++++---
> 1 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
> index 7ad48a8..2fd924d 100644
> --- a/drivers/clk/tegra/clk-super.c
> +++ b/drivers/clk/tegra/clk-super.c
> @@ -73,7 +73,12 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
> {
> struct tegra_clk_super_mux *mux = to_clk_super_mux(hw);
> u32 val, state;
> + int err = 0;
> u8 parent_index, shift;
> + unsigned long flags = 0;
> +
> + if (mux->lock)
> + spin_lock_irqsave(mux->lock, flags);
>
> val = readl_relaxed(mux->reg);
> state = val & SUPER_STATE_MASK;
> @@ -92,8 +97,10 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
> (index == mux->pllx_index))) {
> parent_index = clk_super_get_parent(hw);
> if ((parent_index == mux->div2_index) ||
> - (parent_index == mux->pllx_index))
> - return -EINVAL;
> + (parent_index == mux->pllx_index)) {
> + err = -EINVAL;
> + goto out;
> + }
>
> val ^= SUPER_LP_DIV2_BYPASS;
> writel_relaxed(val, mux->reg);
> @@ -107,7 +114,12 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
>
> writel_relaxed(val, mux->reg);
> udelay(2);
> - return 0;
> +
> +out:
> + if (mux->lock)
> + spin_unlock_irqrestore(mux->lock, flags);
> +
> + return err;
> }
>
> const struct clk_ops tegra_clk_super_ops = {
prev parent reply other threads:[~2013-02-08 5:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-07 16:24 [PATCH] clk: tegra: Implement locking for super clock Peter De Schrijver
2013-02-07 18:57 ` Mike Turquette
2013-02-07 19:13 ` Stephen Warren
2013-02-08 10:16 ` Peter De Schrijver
2013-02-08 5:21 ` Prashant Gaikwad [this message]
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=51148B5B.1090701@nvidia.com \
--to=pgaikwad@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=pdeschrijver@nvidia.com \
--cc=swarren@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).