Skip to content

Commit 08604bd

Browse files
arndbtorvalds
authored andcommitted
time: move PIT_TICK_RATE to linux/timex.h
PIT_TICK_RATE is currently defined in four architectures, but in three different places. While linux/timex.h is not the perfect place for it, it is still a reasonable replacement for those drivers that traditionally use asm/timex.h to get CLOCK_TICK_RATE and expect it to be the PIT frequency. Note that for Alpha, the actual value changed from 1193182UL to 1193180UL. This is unlikely to make a difference, and probably can only improve accuracy. There was a discussion on the correct value of CLOCK_TICK_RATE a few years ago, after which every existing instance was getting changed to 1193182. According to the specification, it should be 1193181.818181... Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Len Brown <lenb@kernel.org> Cc: john stultz <johnstul@us.ibm.com> Cc: Dmitry Torokhov <dtor@mail.ru> Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 03347e2 commit 08604bd

13 files changed

Lines changed: 12 additions & 21 deletions

File tree

‎arch/alpha/include/asm/8253pit.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
/*
22
* 8253/8254 Programmable Interval Timer
33
*/
4-
5-
#ifndef _8253PIT_H
6-
#define _8253PIT_H
7-
8-
#define PIT_TICK_RATE 1193180UL
9-
10-
#endif

‎arch/alpha/kernel/sys_ruffian.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/sched.h>
1515
#include <linux/pci.h>
1616
#include <linux/ioport.h>
17+
#include <linux/timex.h>
1718
#include <linux/init.h>
1819

1920
#include <asm/ptrace.h>

‎arch/mips/include/asm/i8253.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#define PIT_CH0 0x40
1313
#define PIT_CH2 0x42
1414

15-
#define PIT_TICK_RATE 1193182UL
16-
1715
extern spinlock_t i8253_lock;
1816

1917
extern void setup_pit_timer(void);

‎arch/powerpc/include/asm/8253pit.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
#ifndef _ASM_POWERPC_8253PIT_H
2-
#define _ASM_POWERPC_8253PIT_H
3-
41
/*
52
* 8253/8254 Programmable Interval Timer
63
*/
7-
8-
#define PIT_TICK_RATE 1193182UL
9-
10-
#endif /* _ASM_POWERPC_8253PIT_H */

‎arch/x86/include/asm/timex.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include <asm/processor.h>
55
#include <asm/tsc.h>
66

7-
/* The PIT ticks at this frequency (in HZ): */
8-
#define PIT_TICK_RATE 1193182
9-
7+
/* Assume we use the PIT time source for the clock tick */
108
#define CLOCK_TICK_RATE PIT_TICK_RATE
119

1210
#define ARCH_HAS_READ_CURRENT_TIMER

‎arch/x86/kernel/i8253.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/spinlock.h>
88
#include <linux/jiffies.h>
99
#include <linux/module.h>
10+
#include <linux/timex.h>
1011
#include <linux/delay.h>
1112
#include <linux/init.h>
1213
#include <linux/io.h>

‎arch/x86/kernel/tsc.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/delay.h>
1010
#include <linux/clocksource.h>
1111
#include <linux/percpu.h>
12+
#include <linux/timex.h>
1213

1314
#include <asm/hpet.h>
1415
#include <asm/timer.h>

‎drivers/clocksource/acpi_pm.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <linux/acpi_pmtmr.h>
2020
#include <linux/clocksource.h>
21+
#include <linux/timex.h>
2122
#include <linux/errno.h>
2223
#include <linux/init.h>
2324
#include <linux/pci.h>

‎drivers/input/joystick/analog.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include <linux/input.h>
3636
#include <linux/gameport.h>
3737
#include <linux/jiffies.h>
38-
#include <asm/timex.h>
38+
#include <linux/timex.h>
3939

4040
#define DRIVER_DESC "Analog joystick and gamepad driver"
4141

‎drivers/input/misc/pcspkr.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/init.h>
1818
#include <linux/input.h>
1919
#include <linux/platform_device.h>
20+
#include <linux/timex.h>
2021
#include <asm/io.h>
2122

2223
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");

0 commit comments

Comments
 (0)