mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Mike Turquette <mturquette@linaro.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] clk: divider: fix rate calculation for fractional rates
Date: Wed, 6 Nov 2013 11:15:34 +0000	[thread overview]
Message-ID: <20131106111534.GW16735@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1383736008-22764-1-git-send-email-tomi.valkeinen@ti.com>

On Wed, Nov 06, 2013 at 01:06:48PM +0200, Tomi Valkeinen wrote:
> This means that the following code works a bit oddly:
> 
> rate = clk_round_rate(clk, 123428572);
> clk_set_rate(clk, rate);

You're right, but the above sequence is quite a crass thing to do.  Why?

clk_round_rate() returns the clock rate that clk_set_rate() would give
you if you were to use this sequence:

	clk_rate_rate(clk, 123428572);
	rate = clk_get_rate(clk);

The difference is that it doesn't change the actual clock rate itself;
clk_round_rate() is meant to answer the question:

	"If I were to set _this_ rate, what clock rate would
	 the clock give me?"

thereby providing a method for drivers to inquire what the effect would
be when changing such a clock without actually affecting it.

So please, don't use clk_round_rate() followed by clk_set_rate().

  reply	other threads:[~2013-11-06 11:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 11:06 Tomi Valkeinen
2013-11-06 11:15 ` Russell King - ARM Linux [this message]
2013-11-06 11:48   ` Tomi Valkeinen
2013-11-06 16:19     ` Russell King - ARM Linux
2014-01-28  8:45       ` Tomi Valkeinen
2014-01-28 10:32         ` Russell King - ARM Linux
2014-01-28 10:40           ` Tomi Valkeinen
2014-02-11 14:18 ` Tomi Valkeinen

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=20131106111534.GW16735@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=tomi.valkeinen@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®