public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: daniel.lezcano@linaro.org
Cc: marc_gonzalez@sigmadesigns.com, tglx@linutronix.de,
	linux-kernel@vger.kernel.org
Subject: [PATCH] clocksource/drivers/tango-xtal: Replace code by clocksource_mmio_init
Date: Fri, 13 Nov 2015 11:58:12 +0100	[thread overview]
Message-ID: <1447412292-841-1-git-send-email-daniel.lezcano@linaro.org> (raw)

The current code to initialize, register and read the clocksource is
already factored out in mmio.c via the clocksource_mmio_init function.

Factor out the code with the clocksource_mmio_init function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/tango_xtal.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/clocksource/tango_xtal.c b/drivers/clocksource/tango_xtal.c
index d297b30..e756eea 100644
--- a/drivers/clocksource/tango_xtal.c
+++ b/drivers/clocksource/tango_xtal.c
@@ -19,19 +19,6 @@ static u64 notrace read_sched_clock(void)
 	return read_xtal_counter();
 }
 
-static cycle_t read_clocksource(struct clocksource *cs)
-{
-	return read_xtal_counter();
-}
-
-static struct clocksource tango_xtal = {
-	.name	= "tango-xtal",
-	.rating	= 350,
-	.read	= read_clocksource,
-	.mask	= CLOCKSOURCE_MASK(32),
-	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static void __init tango_clocksource_init(struct device_node *np)
 {
 	struct clk *clk;
@@ -53,8 +40,9 @@ static void __init tango_clocksource_init(struct device_node *np)
 	delay_timer.freq = xtal_freq;
 	delay_timer.read_current_timer = read_xtal_counter;
 
-	ret = clocksource_register_hz(&tango_xtal, xtal_freq);
-	if (ret != 0) {
+	ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350,
+				    CLOCKSOURCE_MASK(32), clocksource_mmio_readl_up);
+	if (!ret) {
 		pr_err("%s: registration failed\n", np->full_name);
 		return;
 	}
-- 
1.9.1


             reply	other threads:[~2015-11-13 10:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 10:58 Daniel Lezcano [this message]
2015-11-13 12:20 ` [PATCH] clocksource/drivers/tango-xtal: Replace code by clocksource_mmio_init Marc Gonzalez
2015-11-13 14:16   ` Daniel Lezcano
2015-11-13 14:39     ` Marc Gonzalez
2015-11-13 15:26       ` Thomas Gleixner
2015-11-13 15:39         ` Marc Gonzalez
2015-11-17 12:22   ` Daniel Lezcano
2015-11-17 12:48     ` Marc Gonzalez
2015-11-17 13:08       ` Måns Rullgård
2015-11-17 13:11       ` Daniel Lezcano
2015-11-13 13:33 ` Marc Gonzalez
2015-11-13 14:18   ` Daniel Lezcano

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=1447412292-841-1-git-send-email-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc_gonzalez@sigmadesigns.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