All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Mike Turquette <mturquette@linaro.org>,
	linux-clk@vger.kernel.org,
	Mikko Perttunen <mikko.perttunen@kapsi.fi>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Tony Lindgren <tony@atomide.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Emilio L??pez <emilio@elopez.com.ar>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Tero Kristo <t-kristo@ti.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-mips@linux-mips.org
Subject: Re: [PATCH v3] clk: change clk_ops' ->determine_rate() prototype
Date: Thu, 4 Jun 2015 08:44:34 +0200	[thread overview]
Message-ID: <20150604084434.48939141@bbrezillon> (raw)
In-Reply-To: <20150603233728.GA490@codeaurora.org>

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.
> >=20
> > Change ->determine_rate() prototype to return 0 or an error code, and p=
ass
> > a pointer to a clk_rate_request structure containing the expected target
> > rate and the rate constraints imposed by clk users.
> >=20
> > The clk_rate_request structure might be extended in the future to conta=
in
> > 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 ?).
> >=20
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> >=20
> > CC: Jonathan Corbet <corbet@lwn.net>
> > CC: Tony Lindgren <tony@atomide.com>
> > CC: Ralf Baechle <ralf@linux-mips.org>
> > CC: "Emilio L=C3=B3pez" <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
> > ---
> >=20
> > Hi Stephen,
> >=20
> > This patch is based on clk-next and contains the changes you suggested
> > in your previous review.
> >=20
> > It was tested on sama5d4 and compile tested on several ARM platforms
> > (those enabled in multi_v7_defconfig).
> >=20
>=20
> 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 confli=
ct
> 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.

>=20
> > @@ -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;
> > =20
> >  	if (!clk)
> >  		return 0;
> > =20
> > -	clk_core_get_boundaries(clk->core, &min_rate, &max_rate);
> > +	clk_core_get_boundaries(clk->core, &req.min_rate, &req.max_rate);
> > +	req.rate =3D rate;
> > +
> > +	ret =3D clk_core_round_rate_nolock(clk->core, &req);
> > +	if (ret)
> > +		return ret;
>=20
> This returns a negative int for unsigned long. Is that intentional?

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

Thanks,

Boris


--=20
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Mike Turquette <mturquette@linaro.org>,
	linux-clk@vger.kernel.org,
	Mikko Perttunen <mikko.perttunen@kapsi.fi>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Tony Lindgren <tony@atomide.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Emilio L??pez <emilio@elopez.com.ar>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Tero Kristo <t-kristo@ti.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-mips@linux-mips.org
Subject: Re: [PATCH v3] clk: change clk_ops' ->determine_rate() prototype
Date: Thu, 4 Jun 2015 08:44:34 +0200	[thread overview]
Message-ID: <20150604084434.48939141@bbrezillon> (raw)
In-Reply-To: <20150603233728.GA490@codeaurora.org>

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

WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] clk: change clk_ops' ->determine_rate() prototype
Date: Thu, 4 Jun 2015 08:44:34 +0200	[thread overview]
Message-ID: <20150604084434.48939141@bbrezillon> (raw)
In-Reply-To: <20150603233728.GA490@codeaurora.org>

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 at vger.kernel.org
> > CC: linux-kernel at vger.kernel.org
> > CC: linux-arm-kernel at lists.infradead.org
> > CC: linux-omap at vger.kernel.org
> > CC: linux-mips at 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

  reply	other threads:[~2015-06-04  6:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 16:12 [PATCH v3] clk: change clk_ops' ->determine_rate() prototype Boris Brezillon
2015-05-20 16:12 ` Boris Brezillon
2015-05-20 16:12 ` Boris Brezillon
2015-06-03 23:37 ` Stephen Boyd
2015-06-03 23:37   ` Stephen Boyd
2015-06-04  6:44   ` Boris Brezillon [this message]
2015-06-04  6:44     ` Boris Brezillon
2015-06-04  6:44     ` Boris Brezillon
2015-07-06 17:15   ` Boris Brezillon
2015-07-06 17:15     ` Boris Brezillon

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=20150604084434.48939141@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=corbet@lwn.net \
    --cc=emilio@elopez.com.ar \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=mikko.perttunen@kapsi.fi \
    --cc=mturquette@linaro.org \
    --cc=ralf@linux-mips.org \
    --cc=sboyd@codeaurora.org \
    --cc=t-kristo@ti.com \
    --cc=tomeu.vizoso@collabora.com \
    --cc=tony@atomide.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.