Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1158130 > unrolled thread

Re: [PATCH v3] clk: change clk_ops' ->determine_rate() prototype

Started byStephen Boyd <sboyd@codeaurora.org>
First post2015-06-04 01:40 +0200
Last post2015-06-04 08:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3] clk: change clk_ops' ->determine_rate() prototype Stephen Boyd <sboyd@codeaurora.org> - 2015-06-04 01:40 +0200
    Re: [PATCH v3] clk: change clk_ops' ->determine_rate() prototype Boris Brezillon <boris.brezillon@free-electrons.com> - 2015-06-04 08:50 +0200

#1158130 — Re: [PATCH v3] clk: change clk_ops' ->determine_rate() prototype

FromStephen Boyd <sboyd@codeaurora.org>
Date2015-06-04 01:40 +0200
SubjectRe: [PATCH v3] clk: change clk_ops' ->determine_rate() prototype
Message-ID<pxqql-7S4-1@gated-at.bofh.it>
On 05/20, Boris Brezillon wrote:
> Clock rates are stored in an unsigned long field, but ->determine_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 ->determine_rate() prototype to return 0 or an error code, and pass
> a pointer to a clk_rate_request structure containing the expected target
> rate and the rate constraints imposed by clk users.
> 
> The clk_rate_request structure might be extended in the future to contain
> other kind of constraints like the rounding policy, the maximum clock
> inaccuracy or other things that are not yet supported by the CCF
> (power consumption constraints ?).
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> 
> CC: Jonathan Corbet <corbet@lwn.net>
> CC: Tony Lindgren <tony@atomide.com>
> CC: Ralf Baechle <ralf@linux-mips.org>
> CC: "Emilio López" <emilio@elopez.com.ar>
> CC: Maxime Ripard <maxime.ripard@free-electrons.com>
> CC: Tero Kristo <t-kristo@ti.com>
> CC: linux-doc@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> CC: linux-arm-kernel@lists.infradead.org
> CC: linux-omap@vger.kernel.org
> CC: linux-mips@linux-mips.org
> ---
> 
> Hi Stephen,
> 
> This patch is based on clk-next and contains the changes you suggested
> in your previous review.
> 
> It was tested on sama5d4 and compile tested on several ARM platforms
> (those enabled in multi_v7_defconfig).
> 

Thanks. I think we should wait until the next -rc1 drops to apply the
patch for the next merge window. That will make it least likely to conflict
with other trees, and we can provide it on a stable branch should there
be clock providers going through other trees somewhere. Please
remind me if I forget.

> @@ -1186,15 +1191,21 @@ EXPORT_SYMBOL_GPL(__clk_determine_rate);
>   */
>  unsigned long __clk_round_rate(struct clk *clk, unsigned long rate)
>  {
> -	unsigned long min_rate;
> -	unsigned long max_rate;
> +
> +	struct clk_rate_request req;
> +	int ret;
>  
>  	if (!clk)
>  		return 0;
>  
> -	clk_core_get_boundaries(clk->core, &min_rate, &max_rate);
> +	clk_core_get_boundaries(clk->core, &req.min_rate, &req.max_rate);
> +	req.rate = rate;
> +
> +	ret = clk_core_round_rate_nolock(clk->core, &req);
> +	if (ret)
> +		return ret;

This returns a negative int for unsigned long. Is that intentional?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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/

[toc] | [next] | [standalone]


#1158292

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2015-06-04 08:50 +0200
Message-ID<pxx8u-14y-21@gated-at.bofh.it>
In reply to#1158130
Hi Stefen,

On Wed, 3 Jun 2015 16:37:28 -0700
Stephen Boyd <sboyd@codeaurora.org> wrote:

> On 05/20, Boris Brezillon wrote:
> > Clock rates are stored in an unsigned long field, but ->determine_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 ->determine_rate() prototype to return 0 or an error code, and pass
> > a pointer to a clk_rate_request structure containing the expected target
> > rate and the rate constraints imposed by clk users.
> > 
> > The clk_rate_request structure might be extended in the future to contain
> > other kind of constraints like the rounding policy, the maximum clock
> > inaccuracy or other things that are not yet supported by the CCF
> > (power consumption constraints ?).
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > 
> > CC: Jonathan Corbet <corbet@lwn.net>
> > CC: Tony Lindgren <tony@atomide.com>
> > CC: Ralf Baechle <ralf@linux-mips.org>
> > CC: "Emilio López" <emilio@elopez.com.ar>
> > CC: Maxime Ripard <maxime.ripard@free-electrons.com>
> > CC: Tero Kristo <t-kristo@ti.com>
> > CC: linux-doc@vger.kernel.org
> > CC: linux-kernel@vger.kernel.org
> > CC: linux-arm-kernel@lists.infradead.org
> > CC: linux-omap@vger.kernel.org
> > CC: linux-mips@linux-mips.org
> > ---
> > 
> > Hi Stephen,
> > 
> > This patch is based on clk-next and contains the changes you suggested
> > in your previous review.
> > 
> > It was tested on sama5d4 and compile tested on several ARM platforms
> > (those enabled in multi_v7_defconfig).
> > 
> 
> Thanks. I think we should wait until the next -rc1 drops to apply the
> patch for the next merge window. That will make it least likely to conflict
> with other trees, and we can provide it on a stable branch should there
> be clock providers going through other trees somewhere. Please
> remind me if I forget.

No problem.

> 
> > @@ -1186,15 +1191,21 @@ EXPORT_SYMBOL_GPL(__clk_determine_rate);
> >   */
> >  unsigned long __clk_round_rate(struct clk *clk, unsigned long rate)
> >  {
> > -	unsigned long min_rate;
> > -	unsigned long max_rate;
> > +
> > +	struct clk_rate_request req;
> > +	int ret;
> >  
> >  	if (!clk)
> >  		return 0;
> >  
> > -	clk_core_get_boundaries(clk->core, &min_rate, &max_rate);
> > +	clk_core_get_boundaries(clk->core, &req.min_rate, &req.max_rate);
> > +	req.rate = rate;
> > +
> > +	ret = clk_core_round_rate_nolock(clk->core, &req);
> > +	if (ret)
> > +		return ret;
> 
> This returns a negative int for unsigned long. Is that intentional?

Nope, should be replaced by 'return 0;'.

Thanks,

Boris


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web