linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Afzal Mohammed <afzal@ti.com>
To: <linux-omap@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<devicetree-discuss@lists.ozlabs.org>,
	<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>,
	Tony Lindgren <tony@atomide.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Nicolas Pitre <nico@linaro.org>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Will Deacon <will.deacon@arm.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Landley <rob@landley.net>, Sekhar Nori <nsekhar@ti.com>,
	Syed Mohammed Khasim <khasim@ti.com>
Subject: [RFC 1/8] ARM: localtimer: return percpu clkevt on register
Date: Mon, 18 Feb 2013 12:00:09 +0530	[thread overview]
Message-ID: <e7cbb10903841ba23a93f71e7a06ae34a43adc70.1361166003.git.afzal@ti.com> (raw)
In-Reply-To: <cover.1361166003.git.afzal@ti.com>

Return percpu clock event on local timer register. It is the boot cpu
that calls this and it can use the returned percpu clock event to
register a clock event in the case of SMP configuration with one core.
This helps to have a booting Kernel even if no other timer is
registered for clock tick.

Signed-off-by: Afzal Mohammed <afzal@ti.com>
---
 arch/arm/include/asm/localtimer.h | 7 ++++---
 arch/arm/kernel/smp.c             | 8 ++++----
 arch/arm/kernel/smp_twd.c         | 5 +++--
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index f77ffc1..c3f89c0 100644
--- a/arch/arm/include/asm/localtimer.h
+++ b/arch/arm/include/asm/localtimer.h
@@ -23,11 +23,12 @@ struct local_timer_ops {
 /*
  * Register a local timer driver
  */
-int local_timer_register(struct local_timer_ops *);
+struct clock_event_device *local_timer_register(struct local_timer_ops *);
 #else
-static inline int local_timer_register(struct local_timer_ops *ops)
+static inline
+struct clock_event_device *local_timer_register(struct local_timer_ops *ops)
 {
-	return -ENXIO;
+	return ERR_PTR(-ENXIO);
 }
 #endif
 
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 5f73f70..42d95d6 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -491,16 +491,16 @@ static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt)
 static struct local_timer_ops *lt_ops;
 
 #ifdef CONFIG_LOCAL_TIMERS
-int local_timer_register(struct local_timer_ops *ops)
+struct clock_event_device *local_timer_register(struct local_timer_ops *ops)
 {
 	if (!is_smp() || !setup_max_cpus)
-		return -ENXIO;
+		return ERR_PTR(-ENXIO);
 
 	if (lt_ops)
-		return -EBUSY;
+		return ERR_PTR(-EBUSY);
 
 	lt_ops = ops;
-	return 0;
+	return &per_cpu(percpu_clockevent, smp_processor_id());
 }
 #endif
 
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index c092115..616268c 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -315,6 +315,7 @@ static struct local_timer_ops twd_lt_ops __cpuinitdata = {
 static int __init twd_local_timer_common_register(struct device_node *np)
 {
 	int err;
+	struct clock_event_device *evt;
 
 	twd_evt = alloc_percpu(struct clock_event_device *);
 	if (!twd_evt) {
@@ -328,8 +329,8 @@ static int __init twd_local_timer_common_register(struct device_node *np)
 		goto out_free;
 	}
 
-	err = local_timer_register(&twd_lt_ops);
-	if (err)
+	evt = local_timer_register(&twd_lt_ops);
+	if (IS_ERR(evt))
 		goto out_irq;
 
 	twd_get_clock(np);
-- 
1.7.12


  reply	other threads:[~2013-02-18  6:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18  6:28 [RFC 0/8] ARM: AM43 (OMAP2+) boot support Afzal Mohammed
2013-02-18  6:30 ` Afzal Mohammed [this message]
2013-02-18  6:30 ` [RFC 2/8] ARM: twd: register clock event for 1 core SMP Afzal Mohammed
2013-02-18 13:47   ` Rob Herring
2013-02-19  8:00     ` Mohammed, Afzal
2013-02-18  6:30 ` [RFC 3/8] ARM: twd: clock rate from DT (if no DT clk tree) Afzal Mohammed
2013-02-18  6:30 ` [RFC 4/8] ARM: am33xx: ll debug config help Afzal Mohammed
2013-02-18  6:30 ` [RFC 5/8] ARM: OMAP2+: am43: Kconfig Afzal Mohammed
2013-02-18  6:30 ` [RFC 6/8] ARM: OMAP2+: am43: basic dt support Afzal Mohammed
2013-02-18  6:30 ` [RFC 7/8] ARM: dts: am4372: initial support Afzal Mohammed
2013-02-18  6:30 ` [RFC 8/8] ARM: dts: am43-pre-silicon support Afzal Mohammed

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=e7cbb10903841ba23a93f71e7a06ae34a43adc70.1361166003.git.afzal@ti.com \
    --to=afzal@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=khasim@ti.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=marc.zyngier@arm.com \
    --cc=nico@linaro.org \
    --cc=nsekhar@ti.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.com \
    --cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).