Convert sh to use arch_getoffset() infrastructure
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.
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
@@ -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
@@ -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
@@ -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
@@ -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 };
Quoted 6 lines · john stultz
This patch converts sh to use
GENERIC_TIMEvia thearch_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