mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Stultz <johnstul@us.ibm.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <johnstul@us.ibm.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	Paul Mundt <lethal@linux-sh.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 2/7] sh: convert to clocksource_register_hz
Date: Wed, 20 Oct 2010 16:44:08 -0700	[thread overview]
Message-ID: <1287618253-13258-3-git-send-email-johnstul@us.ibm.com> (raw)
In-Reply-To: <1287618253-13258-2-git-send-email-johnstul@us.ibm.com>

Convert sh_tmu/sh_cmt clocksources to clocksource_register_hz

I was unable to test these, so any help from maintainers would
be appreciated!

Signed-off-by: John Stultz <johnstul@us.ibm.com>
CC: Magnus Damm <magnus.damm@gmail.com>
CC: Paul Mundt <lethal@linux-sh.org>
CC: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/sh_cmt.c |   14 +++++++-------
 drivers/clocksource/sh_tmu.c |   12 ++++++------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 717305d..aeee6ac 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -411,11 +411,16 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
 
 static int sh_cmt_clocksource_enable(struct clocksource *cs)
 {
+	int ret;
 	struct sh_cmt_priv *p = cs_to_sh_cmt(cs);
 
 	p->total_cycles = 0;
 
-	return sh_cmt_start(p, FLAG_CLOCKSOURCE);
+	ret = sh_cmt_start(p, FLAG_CLOCKSOURCE);
+	p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8;
+	
+	__clocksource_updatefreq_hz(cs, p->rate);
+	return ret;
 }
 
 static void sh_cmt_clocksource_disable(struct clocksource *cs)
@@ -448,14 +453,9 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
 	p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8;
 	clk_disable(p->clk);
 
-	/* TODO: calculate good shift from rate and counter bit width */
-	cs->shift = 0;
-	cs->mult = clocksource_hz2mult(p->rate, cs->shift);
-
 	dev_info(&p->pdev->dev, "used as clock source\n");
 
-	clocksource_register(cs);
-
+	clocksource_register_hz(cs, p->rate);
 	return 0;
 }
 
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index de71590..09831d9 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -199,8 +199,11 @@ static cycle_t sh_tmu_clocksource_read(struct clocksource *cs)
 static int sh_tmu_clocksource_enable(struct clocksource *cs)
 {
 	struct sh_tmu_priv *p = cs_to_sh_tmu(cs);
-
-	return sh_tmu_enable(p);
+	int ret = sh_tmu_enable(p);
+	p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8;
+	
+	__clocksource_updatefreq_hz(cs, p->rate);
+	return ret;
 }
 
 static void sh_tmu_clocksource_disable(struct clocksource *cs)
@@ -226,12 +229,9 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
 	/* channel will be configured at parent clock / 4 */
 	p->rate = clk_get_rate(p->clk) / 4;
 	clk_disable(p->clk);
-	/* TODO: calculate good shift from rate and counter bit width */
-	cs->shift = 10;
-	cs->mult = clocksource_hz2mult(p->rate, cs->shift);
 
 	dev_info(&p->pdev->dev, "used as clock source\n");
-	clocksource_register(cs);
+	clocksource_register_hz(cs, p->rate);
 	return 0;
 }
 
-- 
1.6.0.4


  reply	other threads:[~2010-10-20 23:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20 23:44 [PATCH 0/7] clocksource_register_khz/hz cleanups(for 2.6.37?) John Stultz
2010-10-20 23:44 ` [PATCH 1/7] x86: Convert remaining clocksources to clocksource_register_hz/khz John Stultz
2010-10-20 23:44   ` John Stultz [this message]
2010-10-20 23:44     ` [PATCH 3/7] ia64: convert " John Stultz
2010-10-20 23:44       ` [PATCH 4/7] sparc: " John Stultz
2010-10-20 23:44         ` [PATCH 5/7] avr32: Convert to clocksource_register_hz John Stultz
2010-10-20 23:44           ` [PATCH 6/7] mips: convert to clocksource_register_hz/khz John Stultz
2010-10-20 23:44             ` [PATCH 7/7] blackfin: convert to clocksource_register_hz John Stultz
2010-10-21  8:33         ` [PATCH 4/7] sparc: convert to clocksource_register_hz/khz David Miller
2010-10-21 19:16   ` [PATCH 1/7] x86: Convert remaining clocksources " Alok Kataria
2010-10-21 19:39     ` 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=1287618253-13258-3-git-send-email-johnstul@us.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --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

Powered by JetHome