mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Kuleshov <kuleshovmail@gmail.com>
To: John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: [PATCH] clocksource: use clocksource_freq2mult() helper
Date: Wed, 16 Mar 2016 16:21:15 +0600	[thread overview]
Message-ID: <1458123675-20001-1-git-send-email-kuleshovmail@gmail.com> (raw)

which is introduced in the 7aca0c072 commit to simplify calculation of
the mult and shift in the clocks_calc_mult_shift().

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 kernel/time/clocksource.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 56ece14..de57923 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -80,9 +80,7 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 maxsec)
 	 * accuracy and fits the maxsec conversion range:
 	 */
 	for (sft = 32; sft > 0; sft--) {
-		tmp = (u64) to << sft;
-		tmp += from / 2;
-		do_div(tmp, from);
+		tmp = clocksource_freq2mult(from, sft, to);
 		if ((tmp >> sftacc) == 0)
 			break;
 	}
-- 
2.8.0.rc2.216.g1477fb2.dirty

             reply	other threads:[~2016-03-16 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 10:21 Alexander Kuleshov [this message]
2016-04-07 22:28 ` John Stultz
2016-04-08  4:55 ` John Stultz

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=1458123675-20001-1-git-send-email-kuleshovmail@gmail.com \
    --to=kuleshovmail@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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®