diff options
Diffstat (limited to 'include/linux/jiffies.h')
-rw-r--r-- | include/linux/jiffies.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index d7a2555a886c..6acfdbba734b 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -254,23 +254,23 @@ static inline u64 get_jiffies_64(void) | |||
254 | */ | 254 | */ |
255 | static inline unsigned int jiffies_to_msecs(const unsigned long j) | 255 | static inline unsigned int jiffies_to_msecs(const unsigned long j) |
256 | { | 256 | { |
257 | #if HZ <= 1000 && !(1000 % HZ) | 257 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) |
258 | return (1000 / HZ) * j; | 258 | return (MSEC_PER_SEC / HZ) * j; |
259 | #elif HZ > 1000 && !(HZ % 1000) | 259 | #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) |
260 | return (j + (HZ / 1000) - 1)/(HZ / 1000); | 260 | return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); |
261 | #else | 261 | #else |
262 | return (j * 1000) / HZ; | 262 | return (j * MSEC_PER_SEC) / HZ; |
263 | #endif | 263 | #endif |
264 | } | 264 | } |
265 | 265 | ||
266 | static inline unsigned int jiffies_to_usecs(const unsigned long j) | 266 | static inline unsigned int jiffies_to_usecs(const unsigned long j) |
267 | { | 267 | { |
268 | #if HZ <= 1000000 && !(1000000 % HZ) | 268 | #if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) |
269 | return (1000000 / HZ) * j; | 269 | return (USEC_PER_SEC / HZ) * j; |
270 | #elif HZ > 1000000 && !(HZ % 1000000) | 270 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
271 | return (j + (HZ / 1000000) - 1)/(HZ / 1000000); | 271 | return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC); |
272 | #else | 272 | #else |
273 | return (j * 1000000) / HZ; | 273 | return (j * USEC_PER_SEC) / HZ; |
274 | #endif | 274 | #endif |
275 | } | 275 | } |
276 | 276 | ||
@@ -278,12 +278,12 @@ static inline unsigned long msecs_to_jiffies(const unsigned int m) | |||
278 | { | 278 | { |
279 | if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) | 279 | if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) |
280 | return MAX_JIFFY_OFFSET; | 280 | return MAX_JIFFY_OFFSET; |
281 | #if HZ <= 1000 && !(1000 % HZ) | 281 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) |
282 | return (m + (1000 / HZ) - 1) / (1000 / HZ); | 282 | return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ); |
283 | #elif HZ > 1000 && !(HZ % 1000) | 283 | #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) |
284 | return m * (HZ / 1000); | 284 | return m * (HZ / MSEC_PER_SEC); |
285 | #else | 285 | #else |
286 | return (m * HZ + 999) / 1000; | 286 | return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC; |
287 | #endif | 287 | #endif |
288 | } | 288 | } |
289 | 289 | ||
@@ -291,12 +291,12 @@ static inline unsigned long usecs_to_jiffies(const unsigned int u) | |||
291 | { | 291 | { |
292 | if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET)) | 292 | if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET)) |
293 | return MAX_JIFFY_OFFSET; | 293 | return MAX_JIFFY_OFFSET; |
294 | #if HZ <= 1000000 && !(1000000 % HZ) | 294 | #if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) |
295 | return (u + (1000000 / HZ) - 1) / (1000000 / HZ); | 295 | return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ); |
296 | #elif HZ > 1000000 && !(HZ % 1000000) | 296 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
297 | return u * (HZ / 1000000); | 297 | return u * (HZ / USEC_PER_SEC); |
298 | #else | 298 | #else |
299 | return (u * HZ + 999999) / 1000000; | 299 | return (u * HZ + USEC_PER_SEC - 1) / USEC_PER_SEC; |
300 | #endif | 300 | #endif |
301 | } | 301 | } |
302 | 302 | ||