mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
jiffies: Remove HZ > USEC_PER_SEC special case
HZ never goes much further 1000 and a bit. And if we ever reach one tick per microsecond, we might be having a problem. Lets stop maintaining this special case, just leave a paranoid check. Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Christoph Lameter <cl@linux.com> Cc: Ingo Molnar <mingo@kernel.org> Cc; John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com> Cc: Rik van Riel <riel@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
This commit is contained in:
parent
cbfe8fa6cd
commit
e075867681
2 changed files with 8 additions and 11 deletions
|
@ -363,18 +363,11 @@ static inline unsigned long msecs_to_jiffies(const unsigned int m)
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unsigned long __usecs_to_jiffies(const unsigned int u);
|
extern unsigned long __usecs_to_jiffies(const unsigned int u);
|
||||||
#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
|
#if !(USEC_PER_SEC % HZ)
|
||||||
static inline unsigned long _usecs_to_jiffies(const unsigned int u)
|
static inline unsigned long _usecs_to_jiffies(const unsigned int u)
|
||||||
{
|
{
|
||||||
return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ);
|
return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ);
|
||||||
}
|
}
|
||||||
#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
|
|
||||||
static inline unsigned long _usecs_to_jiffies(const unsigned int u)
|
|
||||||
{
|
|
||||||
return u * (HZ / USEC_PER_SEC);
|
|
||||||
}
|
|
||||||
static inline unsigned long _usecs_to_jiffies(const unsigned int u)
|
|
||||||
{
|
|
||||||
#else
|
#else
|
||||||
static inline unsigned long _usecs_to_jiffies(const unsigned int u)
|
static inline unsigned long _usecs_to_jiffies(const unsigned int u)
|
||||||
{
|
{
|
||||||
|
|
|
@ -268,10 +268,14 @@ EXPORT_SYMBOL(jiffies_to_msecs);
|
||||||
|
|
||||||
unsigned int jiffies_to_usecs(const unsigned long j)
|
unsigned int jiffies_to_usecs(const unsigned long j)
|
||||||
{
|
{
|
||||||
#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
|
/*
|
||||||
|
* Hz usually doesn't go much further MSEC_PER_SEC.
|
||||||
|
* jiffies_to_usecs() and usecs_to_jiffies() depend on that.
|
||||||
|
*/
|
||||||
|
BUILD_BUG_ON(HZ > USEC_PER_SEC);
|
||||||
|
|
||||||
|
#if !(USEC_PER_SEC % HZ)
|
||||||
return (USEC_PER_SEC / HZ) * j;
|
return (USEC_PER_SEC / HZ) * j;
|
||||||
#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
|
|
||||||
return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC);
|
|
||||||
#else
|
#else
|
||||||
# if BITS_PER_LONG == 32
|
# if BITS_PER_LONG == 32
|
||||||
return (HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32;
|
return (HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue