Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753665AbbBTD34 (ORCPT ); Thu, 19 Feb 2015 22:29:56 -0500 Received: from mail-ie0-f182.google.com ([209.85.223.182]:34599 "EHLO mail-ie0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753392AbbBTD3z convert rfc822-to-8bit (ORCPT ); Thu, 19 Feb 2015 22:29:55 -0500 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Tomeu Vizoso , linux-kernel@vger.kernel.org From: Mike Turquette In-Reply-To: <1423231981-9600-1-git-send-email-tomeu.vizoso@collabora.com> Cc: "Javier Martinez Canillas" , "Tomeu Vizoso" , "Thierry Reding" , "Peter De Schrijver" , "Stephen Boyd" References: <1423231981-9600-1-git-send-email-tomeu.vizoso@collabora.com> Message-ID: <20150220032941.421.7428@quantum> User-Agent: alot/0.3.5 Subject: Re: [PATCH] clk: Only recalculate the rate if needed Date: Thu, 19 Feb 2015 19:29:41 -0800 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1880 Lines: 56 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 > Cc: Peter De Schrijver > Signed-off-by: Tomeu Vizoso 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/