Skip to content

Commit

Permalink
read_current_timer() cleanups
Browse files Browse the repository at this point in the history
- 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.

[[email protected]: fix build]
Cc: "David S. Miller" <[email protected]>
Cc: Haavard Skinnemoen <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Andi Kleen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
akpm00 authored and Linus Torvalds committed Feb 6, 2008
1 parent 83bad1d commit 941e492
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 14 deletions.
4 changes: 3 additions & 1 deletion arch/avr32/lib/delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@

#include <linux/delay.h>
#include <linux/module.h>
#include <linux/timex.h>
#include <linux/param.h>
#include <linux/types.h>
#include <linux/init.h>

#include <asm/processor.h>
#include <asm/sysreg.h>

int read_current_timer(unsigned long *timer_value)
int __devinit read_current_timer(unsigned long *timer_value)
{
*timer_value = sysreg_read(COUNT);
return 0;
Expand Down
5 changes: 5 additions & 0 deletions arch/sparc64/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,11 @@ static void __exit rtc_mini_exit(void)
misc_deregister(&rtc_mini_dev);
}

int __devinit read_current_timer(unsigned long *timer_val)
{
*timer_val = tick_ops->get_tick();
return 0;
}

module_init(rtc_mini_init);
module_exit(rtc_mini_exit);
4 changes: 3 additions & 1 deletion arch/x86/lib/delay_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

#include <linux/module.h>
#include <linux/sched.h>
#include <linux/timex.h>
#include <linux/preempt.h>
#include <linux/delay.h>
#include <linux/init.h>

#include <asm/processor.h>
#include <asm/delay.h>
Expand Down Expand Up @@ -63,7 +65,7 @@ void use_tsc_delay(void)
delay_fn = delay_tsc;
}

int read_current_timer(unsigned long *timer_val)
int __devinit read_current_timer(unsigned long *timer_val)
{
if (delay_fn == delay_tsc) {
rdtscl(*timer_val);
Expand Down
4 changes: 3 additions & 1 deletion arch/x86/lib/delay_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

#include <linux/module.h>
#include <linux/sched.h>
#include <linux/timex.h>
#include <linux/preempt.h>
#include <linux/delay.h>
#include <linux/init.h>

#include <asm/delay.h>
#include <asm/msr.h>
Expand All @@ -20,7 +22,7 @@
#include <asm/smp.h>
#endif

int read_current_timer(unsigned long *timer_value)
int __devinit read_current_timer(unsigned long *timer_value)
{
rdtscll(*timer_value);
return 0;
Expand Down
3 changes: 1 addition & 2 deletions include/asm-avr32/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ static inline cycles_t get_cycles (void)
return 0;
}

extern int read_current_timer(unsigned long *timer_value);
#define ARCH_HAS_READ_CURRENT_TIMER 1
#define ARCH_HAS_READ_CURRENT_TIMER

#endif /* __ASM_AVR32_TIMEX_H */
6 changes: 1 addition & 5 deletions include/asm-sparc64/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
typedef unsigned long cycles_t;
#define get_cycles() tick_ops->get_tick()

#define ARCH_HAS_READ_CURRENT_TIMER 1
#define read_current_timer(timer_val_p) \
({ *timer_val_p = tick_ops->get_tick(); \
0; \
})
#define ARCH_HAS_READ_CURRENT_TIMER

#endif
3 changes: 1 addition & 2 deletions include/asm-x86/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#endif
#define CLOCK_TICK_RATE PIT_TICK_RATE

extern int read_current_timer(unsigned long *timer_value);
#define ARCH_HAS_READ_CURRENT_TIMER 1
#define ARCH_HAS_READ_CURRENT_TIMER

#endif
2 changes: 2 additions & 0 deletions include/linux/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ extern int do_adjtimex(struct timex *);
/* Don't use! Compatibility define for existing users. */
#define tickadj (500/HZ ? : 1)

int read_current_timer(unsigned long *timer_val);

#endif /* KERNEL */

#endif /* LINUX_TIMEX_H */
3 changes: 1 addition & 2 deletions init/calibrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include <linux/jiffies.h>
#include <linux/delay.h>
#include <linux/init.h>

#include <asm/timex.h>
#include <linux/timex.h>

unsigned long preset_lpj;
static int __init lpj_setup(char *str)
Expand Down

0 comments on commit 941e492

Please sign in to comment.