Commit 660a7358 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent b3cc42df
...@@ -25,8 +25,8 @@ static inline void arch_setup_pc9800(void) ...@@ -25,8 +25,8 @@ static inline void arch_setup_pc9800(void)
{ {
CLOCK_TICK_RATE = PC9800_8MHz_P() ? 1996800 : 2457600; CLOCK_TICK_RATE = PC9800_8MHz_P() ? 1996800 : 2457600;
printk(KERN_DEBUG "CLOCK_TICK_RATE = %d\n", CLOCK_TICK_RATE); printk(KERN_DEBUG "CLOCK_TICK_RATE = %d\n", CLOCK_TICK_RATE);
tick_usec = TICK_USEC; /* ACTHZ period (usec) */ tick_usec = TICK_USEC; /* USER_HZ period (usec) */
tick_nsec = TICK_NSEC; /* USER_HZ period (nsec) */ tick_nsec = TICK_NSEC; /* ACTHZ period (nsec) */
pc9800_misc_flags = PC9800_MISC_FLAGS; pc9800_misc_flags = PC9800_MISC_FLAGS;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -130,7 +130,8 @@ static __inline__ unsigned long ...@@ -130,7 +130,8 @@ static __inline__ unsigned long
timeval_to_jiffies(struct timeval *value) timeval_to_jiffies(struct timeval *value)
{ {
unsigned long sec = value->tv_sec; 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){ if (sec >= MAX_SEC_IN_JIFFIES){
sec = MAX_SEC_IN_JIFFIES; sec = MAX_SEC_IN_JIFFIES;
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))
/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ /* 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 */ /* 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) */ /* a value TUSEC for TICK_USEC (can be set bij adjtimex) */
......
...@@ -439,8 +439,8 @@ static inline void __run_timers(tvec_base_t *base) ...@@ -439,8 +439,8 @@ static inline void __run_timers(tvec_base_t *base)
/* /*
* Timekeeping variables * Timekeeping variables
*/ */
unsigned long tick_usec = TICK_USEC; /* ACTHZ period (usec) */ unsigned long tick_usec = TICK_USEC; /* USER_HZ period (usec) */
unsigned long tick_nsec = TICK_NSEC; /* USER_HZ period (nsec) */ unsigned long tick_nsec = TICK_NSEC; /* ACTHZ period (nsec) */
/* /*
* The current time * The current time
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment