Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754228AbbFDXCa (ORCPT ); Thu, 4 Jun 2015 19:02:30 -0400 Received: from utopia.booyaka.com ([74.50.51.50]:44540 "EHLO utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754175AbbFDXC1 (ORCPT ); Thu, 4 Jun 2015 19:02:27 -0400 Date: Thu, 4 Jun 2015 23:02:25 +0000 (UTC) From: Paul Walmsley To: Boris Brezillon cc: Mike Turquette , Stephen Boyd , 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 , =?ISO-8859-15?Q?Emilio_L=F3pez?= , 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 In-Reply-To: <1430407809-31147-2-git-send-email-boris.brezillon@free-electrons.com> Message-ID: References: <1430407809-31147-1-git-send-email-boris.brezillon@free-electrons.com> <1430407809-31147-2-git-send-email-boris.brezillon@free-electrons.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1543 Lines: 44 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. - Paul -- 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/