Skip to contentSkip to conversation

Convert sh to use arch_getoffset() infrastructure

PATCH In review john stultz 1 participant 2 messages Jun 11, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Convert sh to use arch_getoffset() infrastructure

This patch converts sh to use GENERIC_TIME via the arch_getoffset() infrastructure, reducing the amount of arch specific code we need to maintain.

This patch got dropped last cycle due to the high flux rate of the sh arch at the time, so I wanted to resubmit it again.

This patch applies on top of the "create arch_gettimeoffset infrastructure." patch currently in -tip.

http://git.kernel.org/?p=linux/kernel/git/tip/linux-2.6-tip.git;a=commitdiff;h=7d27558c4138ac6b3684dea35c2f4379b940a7dd;hp=a25cbd045a2ffc42787d4dbcbb9c7118f5f42732

I've taken my best swing at converting this, but I'm not 100% confident I got it right. It does cross compile, so that's hopefully a good sign. Any assistance from arch maintainers or testers to get this merged would be great.

Acked-(once long ago)-by: Paul Mundt <[email protected]>
---

 Kconfig                    |    7 +++--
 include/asm/timer.h        |    4 +-
 kernel/time_32.c           |   63 +++------------------------------------------
 kernel/time_64.c           |   53 +------------------------------------
 kernel/timers/timer-cmt.c  |    2 -
 kernel/timers/timer-mtu2.c |    2 -
 6 files changed, 16 insertions(+), 115 deletions(-)
arch/sh/Kconfig +5 -2
index e7390dd..18166f2 100644
@@ -74,7 +74,7 @@ config GENERIC_IOMAP
 	bool
 
 config GENERIC_TIME
-	def_bool n
+	def_bool y
 
 config GENERIC_CLOCKEVENTS
 	def_bool n
@@ -446,11 +446,14 @@ config SH_TMU
 	bool "TMU timer support"
 	depends on CPU_SH3 || CPU_SH4
 	default y
-	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 	help
 	  This enables the use of the TMU as the system timer.
 
+config ARCH_USES_GETTIMEOFFSET
+	def_bool y
+	depends on !SH_TMU
+
 config SH_CMT
 	bool "CMT timer support"
 	depends on SYS_SUPPORTS_CMT && CPU_SH2
arch/sh/include/asm/timer.h +2 -2
index 4c3b66e..f688df2 100644
@@ -9,7 +9,7 @@ struct sys_timer_ops {
 	int (*init)(void);
 	int (*start)(void);
 	int (*stop)(void);
-#ifndef CONFIG_GENERIC_TIME
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
 	unsigned long (*get_offset)(void);
 #endif
 };
@@ -26,7 +26,7 @@ struct sys_timer {
 extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer;
 extern struct sys_timer *sys_timer;
 
-#ifndef CONFIG_GENERIC_TIME
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
 static inline unsigned long get_timer_offset(void)
 {
 	return sys_timer->ops->get_offset();
arch/sh/kernel/time_32.c +5 -58

77 lines not on this page · raw message

arch/sh/kernel/time_64.c +2 -51

61 lines not on this page · raw message

arch/sh/kernel/timers/timer-cmt.c +1 -1
index 9aa3486..c5e5ad7 100644
@@ -177,7 +177,7 @@ static struct sys_timer_ops cmt_timer_ops = {
 	.init		= cmt_timer_init,
 	.start		= cmt_timer_start,
 	.stop		= cmt_timer_stop,
-#ifndef CONFIG_GENERIC_TIME
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
 	.get_offset	= cmt_timer_get_offset,
 #endif
 };
arch/sh/kernel/timers/timer-mtu2.c +1 -1
index 9b0ef01..8a1dcc2 100644
@@ -191,7 +191,7 @@ struct sys_timer_ops mtu2_timer_ops = {
 	.init		= mtu2_timer_init,
 	.start		= mtu2_timer_start,
 	.stop		= mtu2_timer_stop,
-#ifndef CONFIG_GENERIC_TIME
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
 	.get_offset	= mtu2_timer_get_offset,
 #endif
 };
#1 lore raw
Quoted 6 lines · john stultz

This patch converts sh to use GENERIC_TIME via the arch_getoffset() infrastructure, reducing the amount of arch specific code we need to maintain.

This patch got dropped last cycle due to the high flux rate of the sh arch at the time, so I wanted to resubmit it again.

Bah. Apparently this was only true for the -mm and -tip trees, and this patch is already queued up for 2.6.31 in Paul Mundt's -sh git tree.

Sorry for not catching that sooner.

thanks
-john