From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932637AbbFELiW (ORCPT ); Fri, 5 Jun 2015 07:38:22 -0400 Received: from down.free-electrons.com ([37.187.137.238]:52653 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932460AbbFELiR (ORCPT ); Fri, 5 Jun 2015 07:38:17 -0400 Date: Fri, 5 Jun 2015 13:38:03 +0200 From: Boris Brezillon To: Paul Walmsley , Stephen Boyd Cc: Mike Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Corbet , Shawn Guo , ascha Hauer , David Brown , Daniel Walker , Bryan Huntsman , Tony Lindgren , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi , Ralf Baechle , Max Filippov , Heiko Stuebner , Sylwester Nawrocki , Tomasz Figa , Barry Song , Viresh Kumar , Emilio =?UTF-8?B?TMOzcGV6?= , Maxime Ripard , Peter De Schrijver , Prashant Gaikwad , Stephen Warren , Thierry Reding , Alexandre Courbot , Tero Kristo , Ulf Hansson , Michal Simek , Philipp Zabel , linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-omap@vger.kernel.org, linux-mips@linux-mips.org, patches@opensource.wolfsonmicro.com, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, spear-devel@list.st.com, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, rtc-linux@googlegroups.com Subject: Re: [PATCH v2 1/2] clk: change clk_ops' ->round_rate() prototype Message-ID: <20150605133803.59990a66@bbrezillon> In-Reply-To: References: <1430407809-31147-1-git-send-email-boris.brezillon@free-electrons.com> <1430407809-31147-2-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On Thu, 4 Jun 2015 23:02:25 +0000 (UTC) Paul Walmsley wrote: > Hi folks > > just a brief comment on this one: > > On Thu, 30 Apr 2015, Boris Brezillon wrote: > > > Clock rates are stored in an unsigned long field, but ->round_rate() > > (which returns a rounded rate from a requested one) returns a long > > value (errors are reported using negative error codes), which can lead > > to long overflow if the clock rate exceed 2Ghz. > > > > Change ->round_rate() prototype to return 0 or an error code, and pass the > > requested rate as a pointer so that it can be adjusted depending on > > hardware capabilities. > > ... > > > diff --git a/Documentation/clk.txt b/Documentation/clk.txt > > index 0e4f90a..fca8b7a 100644 > > --- a/Documentation/clk.txt > > +++ b/Documentation/clk.txt > > @@ -68,8 +68,8 @@ the operations defined in clk.h: > > int (*is_enabled)(struct clk_hw *hw); > > unsigned long (*recalc_rate)(struct clk_hw *hw, > > unsigned long parent_rate); > > - long (*round_rate)(struct clk_hw *hw, > > - unsigned long rate, > > + int (*round_rate)(struct clk_hw *hw, > > + unsigned long *rate, > > unsigned long *parent_rate); > > long (*determine_rate)(struct clk_hw *hw, > > unsigned long rate, > > I'd suggest that we should probably go straight to 64-bit rates. There > are already plenty of clock sources that can generate rates higher than > 4GiHz. Yep, that was something I was considering too. If Stephen agrees I'll change that in the next version. BTW, you're referring to the second version of this patch, but things have changed a bit: Stephen recommended to only modify the ->determine_rate() prototype and pass a structure instead of a list of arguments. Here is the last version of this series [1]. Best Regards, Boris [1]http://patchwork.linux-mips.org/patch/10092/ -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com