Skip to content

Commit 941e492

Browse files
akpm00Linus Torvalds
authored andcommitted
read_current_timer() cleanups
- All implementations can be __devinit - The function prototypes were in asm/timex.h but they all must be the same, so create a single declaration in linux/timex.h. - uninline the sparc64 version to match the other architectures - Don't bother #defining ARCH_HAS_READ_CURRENT_TIMER to a particular value. [ezk@cs.sunysb.edu: fix build] Cc: "David S. Miller" <davem@davemloft.net> Cc: Haavard Skinnemoen <hskinnemoen@atmel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 83bad1d commit 941e492

9 files changed

Lines changed: 20 additions & 14 deletions

File tree

‎arch/avr32/lib/delay.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212

1313
#include <linux/delay.h>
1414
#include <linux/module.h>
15+
#include <linux/timex.h>
1516
#include <linux/param.h>
1617
#include <linux/types.h>
18+
#include <linux/init.h>
1719

1820
#include <asm/processor.h>
1921
#include <asm/sysreg.h>
2022

21-
int read_current_timer(unsigned long *timer_value)
23+
int __devinit read_current_timer(unsigned long *timer_value)
2224
{
2325
*timer_value = sysreg_read(COUNT);
2426
return 0;

‎arch/sparc64/kernel/time.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,11 @@ static void __exit rtc_mini_exit(void)
17071707
misc_deregister(&rtc_mini_dev);
17081708
}
17091709

1710+
int __devinit read_current_timer(unsigned long *timer_val)
1711+
{
1712+
*timer_val = tick_ops->get_tick();
1713+
return 0;
1714+
}
17101715

17111716
module_init(rtc_mini_init);
17121717
module_exit(rtc_mini_exit);

‎arch/x86/lib/delay_32.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
#include <linux/module.h>
1414
#include <linux/sched.h>
15+
#include <linux/timex.h>
1516
#include <linux/preempt.h>
1617
#include <linux/delay.h>
18+
#include <linux/init.h>
1719

1820
#include <asm/processor.h>
1921
#include <asm/delay.h>
@@ -63,7 +65,7 @@ void use_tsc_delay(void)
6365
delay_fn = delay_tsc;
6466
}
6567

66-
int read_current_timer(unsigned long *timer_val)
68+
int __devinit read_current_timer(unsigned long *timer_val)
6769
{
6870
if (delay_fn == delay_tsc) {
6971
rdtscl(*timer_val);

‎arch/x86/lib/delay_64.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
#include <linux/module.h>
1212
#include <linux/sched.h>
13+
#include <linux/timex.h>
1314
#include <linux/preempt.h>
1415
#include <linux/delay.h>
16+
#include <linux/init.h>
1517

1618
#include <asm/delay.h>
1719
#include <asm/msr.h>
@@ -20,7 +22,7 @@
2022
#include <asm/smp.h>
2123
#endif
2224

23-
int read_current_timer(unsigned long *timer_value)
25+
int __devinit read_current_timer(unsigned long *timer_value)
2426
{
2527
rdtscll(*timer_value);
2628
return 0;

‎include/asm-avr32/timex.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ static inline cycles_t get_cycles (void)
3434
return 0;
3535
}
3636

37-
extern int read_current_timer(unsigned long *timer_value);
38-
#define ARCH_HAS_READ_CURRENT_TIMER 1
37+
#define ARCH_HAS_READ_CURRENT_TIMER
3938

4039
#endif /* __ASM_AVR32_TIMEX_H */

‎include/asm-sparc64/timex.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
typedef unsigned long cycles_t;
1515
#define get_cycles() tick_ops->get_tick()
1616

17-
#define ARCH_HAS_READ_CURRENT_TIMER 1
18-
#define read_current_timer(timer_val_p) \
19-
({ *timer_val_p = tick_ops->get_tick(); \
20-
0; \
21-
})
17+
#define ARCH_HAS_READ_CURRENT_TIMER
2218

2319
#endif

‎include/asm-x86/timex.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#endif
1515
#define CLOCK_TICK_RATE PIT_TICK_RATE
1616

17-
extern int read_current_timer(unsigned long *timer_value);
18-
#define ARCH_HAS_READ_CURRENT_TIMER 1
17+
#define ARCH_HAS_READ_CURRENT_TIMER
1918

2019
#endif

‎include/linux/timex.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ extern int do_adjtimex(struct timex *);
244244
/* Don't use! Compatibility define for existing users. */
245245
#define tickadj (500/HZ ? : 1)
246246

247+
int read_current_timer(unsigned long *timer_val);
248+
247249
#endif /* KERNEL */
248250

249251
#endif /* LINUX_TIMEX_H */

‎init/calibrate.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include <linux/jiffies.h>
88
#include <linux/delay.h>
99
#include <linux/init.h>
10-
11-
#include <asm/timex.h>
10+
#include <linux/timex.h>
1211

1312
unsigned long preset_lpj;
1413
static int __init lpj_setup(char *str)

0 commit comments

Comments
 (0)