From 660a73583d38e35da377963eaa7657104ed758c1 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 20 Jun 2003 08:13:39 -0700 Subject: [PATCH] revert adjtimex changes From: John Stultz, George Anzinger, Eric Piel There was confusion over the definition of TICK_USEC. TICK_USEC is supposed to be based on USER_HZ, however a recent change caused TICK_USEC to be based on HZ. This broke the adjtimex() interface on systems where USER_HZ != HZ. This patch reverts the change to TICK_USEC, removes an added mis-use of the value and fixes some incorrect comments that could lead to this sort of confusion. Also this patch resolves the related LTP adjtimex failures. --- include/asm-i386/mach-pc9800/setup_arch_pre.h | 4 ++-- include/linux/time.h | 3 ++- include/linux/timex.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/asm-i386/mach-pc9800/setup_arch_pre.h b/include/asm-i386/mach-pc9800/setup_arch_pre.h index 47d5f0c7c140..bd53bddd6956 100644 --- a/include/asm-i386/mach-pc9800/setup_arch_pre.h +++ b/include/asm-i386/mach-pc9800/setup_arch_pre.h @@ -25,8 +25,8 @@ static inline void arch_setup_pc9800(void) { CLOCK_TICK_RATE = PC9800_8MHz_P() ? 1996800 : 2457600; printk(KERN_DEBUG "CLOCK_TICK_RATE = %d\n", CLOCK_TICK_RATE); - tick_usec = TICK_USEC; /* ACTHZ period (usec) */ - tick_nsec = TICK_NSEC; /* USER_HZ period (nsec) */ + tick_usec = TICK_USEC; /* USER_HZ period (usec) */ + tick_nsec = TICK_NSEC; /* ACTHZ period (nsec) */ pc9800_misc_flags = PC9800_MISC_FLAGS; #ifdef CONFIG_SMP diff --git a/include/linux/time.h b/include/linux/time.h index 12d0a89a4ee9..e739d8128253 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -130,7 +130,8 @@ static __inline__ unsigned long timeval_to_jiffies(struct timeval *value) { unsigned long sec = value->tv_sec; - long usec = value->tv_usec + TICK_USEC - 1; + long usec = value->tv_usec + + ((TICK_NSEC + 1000UL/2) / 1000UL) - 1; if (sec >= MAX_SEC_IN_JIFFIES){ sec = MAX_SEC_IN_JIFFIES; diff --git a/include/linux/timex.h b/include/linux/timex.h index 593cdf411500..2b1665d57ad0 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h @@ -176,7 +176,7 @@ #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) /* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ -#define TICK_USEC ((TICK_NSEC + 1000UL/2) / 1000UL) +#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) /* TICK_USEC_TO_NSEC is the time between ticks in nsec assuming real ACTHZ and */ /* a value TUSEC for TICK_USEC (can be set bij adjtimex) */ -- cgit v1.2.3