linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: avoid undef on ARCH_HAS_READ_CURRENT_TIMER
@ 2012-09-11 16:19 Cyril Chemparathy
  2012-09-11 16:25 ` Will Deacon
  2012-09-11 18:01 ` Russell King - ARM Linux
  0 siblings, 2 replies; 11+ messages in thread
From: Cyril Chemparathy @ 2012-09-11 16:19 UTC (permalink / raw)
  To: linux-arm-kernel

With the inclusion of asm-generic/timex.h, the ARM arch timer implementation
breaks on build.  This is because asm/arch_timer.h now defines
ARCH_HAS_READ_CURRENT_TIMER, only to have this macro undefined by the
subsequent inclusion of asm-generic/timex.h.

This patch fixes the problem in asm/timex.h by including asm-generic/timex.h
early, and by defining get_cycles even earlier.

This patch has been tested against linux-next-20120910, both with and without
arch timer support.

Signed-off-by: Cyril Chemparathy <cyril@ti.com>
---
 arch/arm/include/asm/arch_timer.h |    1 +
 arch/arm/include/asm/timex.h      |   14 +++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 62e7547..6beb06a 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -7,6 +7,7 @@
 #define ARCH_HAS_READ_CURRENT_TIMER
 int arch_timer_of_register(void);
 int arch_timer_sched_clock_init(void);
+int read_current_timer(cycles_t *c);
 #else
 static inline int arch_timer_of_register(void)
 {
diff --git a/arch/arm/include/asm/timex.h b/arch/arm/include/asm/timex.h
index 5e71172..76f4217 100644
--- a/arch/arm/include/asm/timex.h
+++ b/arch/arm/include/asm/timex.h
@@ -12,13 +12,21 @@
 #ifndef _ASMARM_TIMEX_H
 #define _ASMARM_TIMEX_H
 
+#define get_cycles get_cycles
+
+#include <asm-generic/timex.h>
 #include <asm/arch_timer.h>
 #include <mach/timex.h>
 
+static inline cycles_t get_cycles(void)
+{
 #ifdef ARCH_HAS_READ_CURRENT_TIMER
-#define get_cycles()	({ cycles_t c; read_current_timer(&c) ? 0 : c; })
-#endif
+	cycles_t c;
 
-#include <asm-generic/timex.h>
+	if (!read_current_timer(&c))
+		return c;
+#endif
+	return 0;
+}
 
 #endif
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-09-11 19:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 16:19 [PATCH] ARM: avoid undef on ARCH_HAS_READ_CURRENT_TIMER Cyril Chemparathy
2012-09-11 16:25 ` Will Deacon
2012-09-11 16:59   ` Cyril Chemparathy
2012-09-11 17:20     ` Will Deacon
2012-09-11 17:28       ` Cyril Chemparathy
2012-09-11 17:53         ` Will Deacon
2012-09-11 18:31           ` Cyril Chemparathy
2012-09-11 19:28             ` Russell King - ARM Linux
2012-09-11 19:41               ` Cyril Chemparathy
2012-09-11 18:01 ` Russell King - ARM Linux
2012-09-11 18:16   ` Will Deacon

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).