From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 12/15] ARM: smp_twd: remove support for non-standalone version
Date: Thu, 22 Dec 2011 17:27:42 +0000 [thread overview]
Message-ID: <1324574865-5367-13-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1324574865-5367-1-git-send-email-marc.zyngier@arm.com>
There is no in-tree platform using both CONFIG_LOCAL_TIMERS and
CONFIG_HAVE_ARM_TWD. As such, some code can be removed and some
exported functions of smp_twd.c can be made static.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/Kconfig | 1 -
arch/arm/include/asm/localtimer.h | 10 ------
arch/arm/include/asm/smp_twd.h | 5 ---
arch/arm/kernel/smp_twd.c | 65 ++++++++++--------------------------
4 files changed, 18 insertions(+), 63 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c37410a..c3732bb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1566,7 +1566,6 @@ config LOCAL_TIMERS
bool "Use local timer interrupts"
depends on SMP && !ARM_SMP_TWD
default y
- select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !EXYNOS4_MCT)
help
Enable support for local timers on SMP platforms, rather then the
legacy IPI broadcast method. Local timers allows the system
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index c6a1842..5f21c37 100644
--- a/arch/arm/include/asm/localtimer.h
+++ b/arch/arm/include/asm/localtimer.h
@@ -22,21 +22,11 @@ void percpu_timer_setup(void);
#ifdef CONFIG_LOCAL_TIMERS
-#ifdef CONFIG_HAVE_ARM_TWD
-
-#include "smp_twd.h"
-
-#define local_timer_stop(c) twd_timer_stop((c))
-
-#else
-
/*
* Stop the local timer
*/
void local_timer_stop(struct clock_event_device *);
-#endif
-
/*
* Setup a local timer interrupt for a CPU.
*/
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index 09c3b71..1479a6f 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -18,14 +18,9 @@
#define TWD_TIMER_CONTROL_PERIODIC (1 << 1)
#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2)
-struct clock_event_device;
struct resource;
struct of_device_id;
-extern void __iomem *twd_base;
-
-void twd_timer_setup(struct clock_event_device *);
-void twd_timer_stop(struct clock_event_device *);
#ifdef CONFIG_HAVE_ARM_TWD
int twd_timer_register(struct resource *res, int res_nr);
int twd_timer_of_init(const struct of_device_id *twd_of_match);
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 98a6a59..aec1bc1 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -18,21 +18,18 @@
#include <linux/clockchips.h>
#include <linux/irq.h>
#include <linux/io.h>
+#include <linux/interrupt.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
#include <asm/smp_plat.h>
#include <asm/smp_twd.h>
-#include <asm/localtimer.h>
-#include <asm/hardware/gic.h>
-
-/* set up by the platform code */
-void __iomem *twd_base;
+static void __iomem *twd_base;
+static struct clock_event_device __percpu *twd_clock_event;
+static int twd_ppi;
static unsigned long twd_timer_rate;
-static struct clock_event_device __percpu **twd_evt;
-
static void twd_set_mode(enum clock_event_mode mode,
struct clock_event_device *clk)
{
@@ -87,7 +84,7 @@ int twd_timer_ack(void)
return 0;
}
-void twd_timer_stop(struct clock_event_device *clk)
+static void twd_timer_stop(struct clock_event_device *clk)
{
twd_set_mode(CLOCK_EVT_MODE_UNUSED, clk);
disable_percpu_irq(clk->irq);
@@ -134,7 +131,7 @@ static void __cpuinit twd_calibrate_rate(void)
static irqreturn_t twd_handler(int irq, void *dev_id)
{
- struct clock_event_device *evt = *(struct clock_event_device **)dev_id;
+ struct clock_event_device *evt = dev_id;
if (twd_timer_ack()) {
evt->event_handler(evt);
@@ -147,28 +144,8 @@ static irqreturn_t twd_handler(int irq, void *dev_id)
/*
* Setup the local clock events for a CPU.
*/
-void __cpuinit twd_timer_setup(struct clock_event_device *clk)
+static void __cpuinit twd_timer_setup(struct clock_event_device *clk)
{
- struct clock_event_device **this_cpu_clk;
-
- if (!twd_evt) {
- int err;
-
- twd_evt = alloc_percpu(struct clock_event_device *);
- if (!twd_evt) {
- pr_err("twd: can't allocate memory\n");
- return;
- }
-
- err = request_percpu_irq(clk->irq, twd_handler,
- "twd", twd_evt);
- if (err) {
- pr_err("twd: can't register interrupt %d (%d)\n",
- clk->irq, err);
- return;
- }
- }
-
twd_calibrate_rate();
__raw_writel(0, twd_base + TWD_TIMER_CONTROL);
@@ -183,26 +160,14 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
clk->mult = div_sc(twd_timer_rate, NSEC_PER_SEC, clk->shift);
clk->max_delta_ns = clockevent_delta2ns(0xffffffff, clk);
clk->min_delta_ns = clockevent_delta2ns(0xf, clk);
-
- this_cpu_clk = __this_cpu_ptr(twd_evt);
- *this_cpu_clk = clk;
+ clk->cpumask = cpumask_of(smp_processor_id());
+ clk->irq = twd_ppi;
clockevents_register_device(clk);
enable_percpu_irq(clk->irq, 0);
}
-#ifdef CONFIG_ARM_SMP_TWD
-static struct clock_event_device __percpu *twd_clock_event;
-static int twd_ppi;
-
-static void __cpuinit twd_setup(struct clock_event_device *clk)
-{
- clk->cpumask = cpumask_of(smp_processor_id());
- clk->irq = twd_ppi;
- twd_timer_setup(clk);
-}
-
static void __cpuinit twd_teardown(void *data)
{
struct clock_event_device *clk = data;
@@ -218,7 +183,7 @@ static int __cpuinit twd_cpu_notify(struct notifier_block *self,
switch (action) {
case CPU_STARTING:
case CPU_STARTING_FROZEN:
- twd_setup(clk);
+ twd_timer_setup(clk);
break;
case CPU_DOWN_PREPARE:
@@ -250,9 +215,16 @@ static int __init twd_timer_common_init(void)
goto out_free;
}
+ err = request_percpu_irq(twd_ppi, twd_handler, "twd", twd_clock_event);
+ if (err) {
+ pr_err("twd: can't register interrupt %d (%d)\n",
+ twd_ppi, err);
+ goto out_free;
+ }
+
/* Immediately configure the timer on the boot CPU */
clk = per_cpu_ptr(twd_clock_event, smp_processor_id());
- twd_setup(clk);
+ twd_timer_setup(clk);
register_cpu_notifier(&twd_cpu_nb);
@@ -302,4 +274,3 @@ int __init twd_timer_of_init(const struct of_device_id *twd_of_match)
return twd_timer_common_init();
}
#endif
-#endif
--
1.7.7.1
next prev parent reply other threads:[~2011-12-22 17:27 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-22 17:27 [PATCH v2 00/15] Make SMP timers standalone Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 01/15] ARM: local timers: allow smp_twd to be used standalone Marc Zyngier
2011-12-22 20:38 ` Russell King - ARM Linux
2011-12-22 17:27 ` [PATCH v2 02/15] ARM: smp_twd: add device tree support Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 03/15] ARM: local timers: switch realview to standalone smp_twd Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 04/15] ARM: local timers: switch vexpress " Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 05/15] ARM: local timers: remove localtimer.c from plat-versatile Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 06/15] ARM: local timers: switch tegra to standalone smp_twd Marc Zyngier
2011-12-22 19:22 ` Colin Cross
2011-12-22 17:27 ` [PATCH v2 07/15] ARM: local timers: switch omap4 " Marc Zyngier
2011-12-23 6:37 ` Shilimkar, Santosh
2011-12-22 17:27 ` [PATCH v2 08/15] ARM: local timers: switch shmobile " Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 09/15] ARM: local timers: switch ux500 " Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 10/15] ARM: local timers: switch highbank " Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 11/15] ARM: local timers: switch imx6q " Marc Zyngier
2011-12-25 13:40 ` Shawn Guo
2011-12-22 17:27 ` Marc Zyngier [this message]
2011-12-22 17:27 ` [PATCH v2 13/15] ARM: local timers: make MCT timer standalone Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 14/15] ARM: local timers: make MSM timers standalone Marc Zyngier
2011-12-22 17:27 ` [PATCH v2 15/15] ARM: local timers: Remove CONFIG_LOCAL_TIMERS support Marc Zyngier
2011-12-22 19:32 ` [PATCH v2 00/15] Make SMP timers standalone Russell King - ARM Linux
2012-01-04 17:39 ` Marc Zyngier
2012-01-04 21:47 ` Russell King - ARM Linux
2012-01-05 0:00 ` Linus Walleij
2012-01-05 11:08 ` Marc Zyngier
2012-01-05 11:13 ` Shilimkar, Santosh
2012-01-05 11:19 ` Marc Zyngier
2012-01-05 11:26 ` Russell King - ARM Linux
2012-01-05 11:35 ` Marc Zyngier
2012-01-05 12:10 ` Russell King - ARM Linux
2012-01-05 16:13 ` Marc Zyngier
2012-01-05 16:26 ` Russell King - ARM Linux
2012-01-05 16:55 ` Russell King - ARM Linux
2012-01-05 11:31 ` Shilimkar, Santosh
2012-01-05 10:33 ` Marc Zyngier
2012-01-05 10:45 ` Shilimkar, Santosh
2012-01-05 1:17 ` David Brown
2012-01-05 10:26 ` Linus Walleij
2012-01-05 11:01 ` Russell King - ARM Linux
2012-01-05 19:34 ` johlstei
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=1324574865-5367-13-git-send-email-marc.zyngier@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).