Skip to contentSkip to conversation

sparc: convert to arch_gettimeoffset()

PATCH Applied [email protected] 3 participants 6 messages Dec 22, 2009 – Jan 15, 2010 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: convert to arch_gettimeoffset()

From: john stultz <[email protected]>

Convert sparc (specifically sparc32) to use GENERIC_TIME via the arch_getoffset() infrastructure, reducing the amount of arch specific code we need to maintain.

The sparc architecture is one of the last 3 arches that need to be converted.

---

 arch/sparc/Kconfig          |    5 +
 arch/sparc/kernel/pcic.c    |  104 +++++-------------------------
 arch/sparc/kernel/time_32.c |  115 +++++++---------------------------
 3 files changed, 45 insertions(+), 179 deletions(-)
arch/sparc/Kconfig renamed from arch/sparc/Kconfig~convert-sparc-to-arch_gettimeoffset +4 -1
diff -puN arch/sparc/Kconfig~convert-sparc-to-arch_gettimeoffset arch/sparc/Kconfig
@@ -64,8 +64,11 @@ config BITS
 	default 64 if SPARC64
 
 config GENERIC_TIME
+	def_bool y
+
+config ARCH_USES_GETTIMEOFFSET
 	bool
-	default y if SPARC64
+	default y if SPARC32
 
 config GENERIC_CMOS_UPDATE
 	bool
arch/sparc/kernel/pcic.c renamed from arch/sparc/kernel/pcic.c~convert-sparc-to-arch_gettimeoffset +16 -86

126 lines not on this page · raw message

arch/sparc/kernel/time_32.c renamed from arch/sparc/kernel/time_32.c~convert-sparc-to-arch_gettimeoffset +24 -91

158 lines not on this page · raw message

_

maintainer
#1 lore raw

From: [email protected]
Date: Mon, 21 Dec 2009 16:28:05 -0800

Review

Quoted 2 lines
(quoted diff) +2 -0
+extern u32 (*do_arch_gettimeoffset)(void);
+

Please put this declaration into a header file that both pcic.c and time_32.c can include, rather than pcic.c

Otherwise sparse will complain, time_32.c's definition can get out of sync, etc.

Thanks.

#2 lore raw
In reply to [email protected]
Quoted 11 lines · David Miller

From: [email protected]
Date: Mon, 21 Dec 2009 16:28:05 -0800

Review

Quoted 2 lines
(quoted diff) +2 -0
+extern u32 (*do_arch_gettimeoffset)(void);
+

Please put this declaration into a header file that both pcic.c and time_32.c can include, rather than pcic.c

Otherwise sparse will complain, time_32.c's definition can get out of sync, etc.

Would this do it?

thanks
-john

Move do_arch_gettimeoffset function pointer declaration to a timex_32.h

Uncompiled/Untested

arch/sparc/include/asm/timex_32.h +1 -0
index b6ccdb0..a254750 100644
@@ -12,4 +12,5 @@
 typedef unsigned long cycles_t;
 #define get_cycles()	(0)
 
+extern u32 (*do_arch_gettimeoffset)(void);
 #endif
arch/sparc/kernel/pcic.c +1 -2
index 8ff470c..4e2724e 100644
@@ -30,6 +30,7 @@
 #include <asm/oplib.h>
 #include <asm/prom.h>
 #include <asm/pcic.h>
+#include <asm/timex.h>
 #include <asm/timer.h>
 #include <asm/uaccess.h>
 #include <asm/irq_regs.h>
@@ -714,8 +715,6 @@ static irqreturn_t pcic_timer_handler (int irq, void *h)
 #define USECS_PER_JIFFY  10000  /* We have 100HZ "standard" timer for sparc */
 #define TICK_TIMER_LIMIT ((100*1000000/4)/100)
 
-extern u32 (*do_arch_gettimeoffset)(void);
-
 u32 pci_gettimeoffset(void)
 {
 	/*
arch/sparc/kernel/time_32.c +1 -0
index 9b440c0..0d4c09b 100644
@@ -35,6 +35,7 @@
 #include <linux/platform_device.h>
 
 #include <asm/oplib.h>
+#include <asm/timex.h>
 #include <asm/timer.h>
 #include <asm/system.h>
 #include <asm/irq.h>
maintainer
#3 lore raw
In reply to [email protected]

From: john stultz <[email protected]>
Date: Tue, 12 Jan 2010 18:00:57 -0800

Quoted 10 lines · David Miller
Quoted 9 lines

From: [email protected]
Date: Mon, 21 Dec 2009 16:28:05 -0800

Review

Quoted 2 lines
(quoted diff) +2 -0
+extern u32 (*do_arch_gettimeoffset)(void);
+

Please put this declaration into a header file that both pcic.c and time_32.c can include, rather than pcic.c

Quoted 5 lines
Quoted 2 lines

Otherwise sparse will complain, time_32.c's definition can get out of sync, etc.

Would this do it?

Yes, but you need to fully respin your original patch, incorporating this change.

Thanks.

#4 lore raw
In reply to [email protected]
Quoted 13 lines · David Miller

From: john stultz <[email protected]>
Date: Tue, 12 Jan 2010 18:00:57 -0800

Quoted 10 lines · David Miller
Quoted 9 lines

From: [email protected]
Date: Mon, 21 Dec 2009 16:28:05 -0800

Review

Quoted 2 lines
(quoted diff) +2 -0
+extern u32 (*do_arch_gettimeoffset)(void);
+

Please put this declaration into a header file that both pcic.c and time_32.c can include, rather than pcic.c

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Otherwise sparse will complain, time_32.c's definition can get out of sync, etc.

Would this do it?

Yes, but you need to fully respin your original patch, incorporating this change.

Sure thing.

thanks
-john

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

The sparc architecture is one of the last 3 arches that need to be converted.

This patch applies on top of Linus' current -git tree

I've taken my best swing at converting this, but I'm not 100% confident I got it right. My cross-compiler is now out of date (gcc4.2) so I wasn't able to check if it compiled. Any assistance from arch maintainers or testers to get this merged would be great.

arch/sparc/Kconfig +4 -1
index 108197a..4097f6a 100644
@@ -64,8 +64,11 @@ config BITS
 	default 64 if SPARC64
 
 config GENERIC_TIME
+	def_bool y
+
+config ARCH_USES_GETTIMEOFFSET
 	bool
-	default y if SPARC64
+	default y if SPARC32
 
 config GENERIC_CMOS_UPDATE
 	bool
arch/sparc/include/asm/timex_32.h +1 -0
index b6ccdb0..a254750 100644
@@ -12,4 +12,5 @@
 typedef unsigned long cycles_t;
 #define get_cycles()	(0)
 
+extern u32 (*do_arch_gettimeoffset)(void);
 #endif
arch/sparc/kernel/pcic.c +15 -86

131 lines not on this page · raw message

arch/sparc/kernel/time_32.c +25 -91

165 lines not on this page · raw message