diff options
Diffstat (limited to 'kernel/time.c')
-rw-r--r-- | kernel/time.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/kernel/time.c b/kernel/time.c index 5cb80533d8b5..8e8dc6d705c9 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -645,7 +645,7 @@ u64 nsec_to_clock_t(u64 x) | |||
645 | } | 645 | } |
646 | 646 | ||
647 | /** | 647 | /** |
648 | * nsecs_to_jiffies - Convert nsecs in u64 to jiffies | 648 | * nsecs_to_jiffies64 - Convert nsecs in u64 to jiffies64 |
649 | * | 649 | * |
650 | * @n: nsecs in u64 | 650 | * @n: nsecs in u64 |
651 | * | 651 | * |
@@ -657,7 +657,7 @@ u64 nsec_to_clock_t(u64 x) | |||
657 | * NSEC_PER_SEC = 10^9 = (5^9 * 2^9) = (1953125 * 512) | 657 | * NSEC_PER_SEC = 10^9 = (5^9 * 2^9) = (1953125 * 512) |
658 | * ULLONG_MAX ns = 18446744073.709551615 secs = about 584 years | 658 | * ULLONG_MAX ns = 18446744073.709551615 secs = about 584 years |
659 | */ | 659 | */ |
660 | unsigned long nsecs_to_jiffies(u64 n) | 660 | u64 nsecs_to_jiffies64(u64 n) |
661 | { | 661 | { |
662 | #if (NSEC_PER_SEC % HZ) == 0 | 662 | #if (NSEC_PER_SEC % HZ) == 0 |
663 | /* Common case, HZ = 100, 128, 200, 250, 256, 500, 512, 1000 etc. */ | 663 | /* Common case, HZ = 100, 128, 200, 250, 256, 500, 512, 1000 etc. */ |
@@ -674,6 +674,24 @@ unsigned long nsecs_to_jiffies(u64 n) | |||
674 | #endif | 674 | #endif |
675 | } | 675 | } |
676 | 676 | ||
677 | /** | ||
678 | * nsecs_to_jiffies - Convert nsecs in u64 to jiffies | ||
679 | * | ||
680 | * @n: nsecs in u64 | ||
681 | * | ||
682 | * Unlike {m,u}secs_to_jiffies, type of input is not unsigned int but u64. | ||
683 | * And this doesn't return MAX_JIFFY_OFFSET since this function is designed | ||
684 | * for scheduler, not for use in device drivers to calculate timeout value. | ||
685 | * | ||
686 | * note: | ||
687 | * NSEC_PER_SEC = 10^9 = (5^9 * 2^9) = (1953125 * 512) | ||
688 | * ULLONG_MAX ns = 18446744073.709551615 secs = about 584 years | ||
689 | */ | ||
690 | unsigned long nsecs_to_jiffies(u64 n) | ||
691 | { | ||
692 | return (unsigned long)nsecs_to_jiffies64(n); | ||
693 | } | ||
694 | |||
677 | /* | 695 | /* |
678 | * Add two timespec values and do a safety check for overflow. | 696 | * Add two timespec values and do a safety check for overflow. |
679 | * It's assumed that both values are valid (>= 0) | 697 | * It's assumed that both values are valid (>= 0) |