linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette@linaro.org>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>, linux-kernel@vger.kernel.org
Cc: "Javier Martinez Canillas" <javier.martinez@collabora.co.uk>,
	"Tomeu Vizoso" <tomeu.vizoso@collabora.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Peter De Schrijver" <pdeschrijver@nvidia.com>,
	"Stephen Boyd" <sboyd@codeaurora.org>
Subject: Re: [PATCH] clk: Only recalculate the rate if needed
Date: Thu, 19 Feb 2015 19:29:41 -0800	[thread overview]
Message-ID: <20150220032941.421.7428@quantum> (raw)
In-Reply-To: <1423231981-9600-1-git-send-email-tomeu.vizoso@collabora.com>

Quoting Tomeu Vizoso (2015-02-06 06:13:01)
> We don't really need to recalculate the effective rate of a clock when a
> per-user clock is removed, if the constraints of the later aren't
> limiting the requested rate.
> 
> This was causing problems with clocks that never had a rate set before,
> as rate_req would be zero. Though this could be considered a bug in the
> implementation of those clocks, this should be checked somewhere else.
> 
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>

Fixes: 1c8e600440c7 ("clk: Add rate constraints to clocks")

Applied to clk-next. With this fix sunxi no longer vomits WARNs
everywhere due to divide-by-zero in the following path:

of_clk_init -> parent_ready -> __clk_put

Thanks,
Mike

> 
> ---
> 
> This applies on top of https://lkml.org/lkml/2015/2/5/769
> ---
>  drivers/clk/clk.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index a7d37c3..4ea2d53 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -2664,7 +2664,11 @@ void __clk_put(struct clk *clk)
>         clk_prepare_lock();
>  
>         hlist_del(&clk->clks_node);
> -       clk_core_set_rate_nolock(clk->core, clk->core->req_rate);
> +
> +       if (clk->min_rate > clk->core->req_rate ||
> +           clk->max_rate < clk->core->req_rate)
> +               clk_core_set_rate_nolock(clk->core, clk->core->req_rate);
> +
>         owner = clk->core->owner;
>         kref_put(&clk->core->ref, __clk_release);
>  
> -- 
> 1.9.3
> 

      reply	other threads:[~2015-02-20  3:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06 14:13 [PATCH] clk: Only recalculate the rate if needed Tomeu Vizoso
2015-02-20  3:29 ` Mike Turquette [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=20150220032941.421.7428@quantum \
    --to=mturquette@linaro.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pdeschrijver@nvidia.com \
    --cc=sboyd@codeaurora.org \
    --cc=thierry.reding@gmail.com \
    --cc=tomeu.vizoso@collabora.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).