diff options
| -rw-r--r-- | include/linux/jiffies.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 265e2c3cbd1c..7d24466fb80b 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
| @@ -39,9 +39,6 @@ | |||
| 39 | # error Invalid value of HZ. | 39 | # error Invalid value of HZ. |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
| 42 | /* LATCH is used in the interval timer and ftape setup. */ | ||
| 43 | #define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ | ||
| 44 | |||
| 45 | /* Suppose we want to divide two numbers NOM and DEN: NOM/DEN, then we can | 42 | /* Suppose we want to divide two numbers NOM and DEN: NOM/DEN, then we can |
| 46 | * improve accuracy by shifting LSH bits, hence calculating: | 43 | * improve accuracy by shifting LSH bits, hence calculating: |
| 47 | * (NOM << LSH) / DEN | 44 | * (NOM << LSH) / DEN |
| @@ -54,8 +51,15 @@ | |||
| 54 | #define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \ | 51 | #define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \ |
| 55 | + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN)) | 52 | + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN)) |
| 56 | 53 | ||
| 54 | #ifdef CLOCK_TICK_RATE | ||
| 55 | /* LATCH is used in the interval timer and ftape setup. */ | ||
| 56 | # define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ | ||
| 57 | |||
| 57 | /* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ | 58 | /* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ |
| 58 | #define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) | 59 | # define ACTHZ (SH_DIV(CLOCK_TICK_RATE, LATCH, 8)) |
| 60 | #else | ||
| 61 | # define ACTHZ (HZ << 8) | ||
| 62 | #endif | ||
| 59 | 63 | ||
| 60 | /* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */ | 64 | /* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */ |
| 61 | #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) | 65 | #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) |
