summaryrefslogtreecommitdiff
path: root/drivers/idle
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2020-01-17 13:46:24 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2020-01-23 02:37:02 +0300
commit86e9466ae620824dee861f0f6ed933fcd0b449f3 (patch)
tree43b210a9685b68e5b9d13846f57ecd399a683d64 /drivers/idle
parent1aefbd7aeb7695c1a9e6ece9a1612ee88e1ea3f8 (diff)
downloadlinux-86e9466ae620824dee861f0f6ed933fcd0b449f3.tar.xz
intel_idle: Clean up irtl_2_usec()
Move the irtl_ns_units[] definition into irtl_2_usec() which is the only user of it, use div_u64() for the division in there (as the divisor is small enough) and use the NSEC_PER_USEC symbol for the divisor. Also convert the irtl_2_usec() comment to a proper kerneldo one. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/idle')
-rw-r--r--drivers/idle/intel_idle.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 27c50fba26d5..9f38ff02a7b8 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1292,16 +1292,17 @@ static void __init ivt_idle_state_table_update(void)
/* else, 1 and 2 socket systems use default ivt_cstates */
}
-/*
- * Translate IRTL (Interrupt Response Time Limit) MSR to usec
+/**
+ * irtl_2_usec - IRTL to microseconds conversion.
+ * @irtl: IRTL MSR value.
+ *
+ * Translate the IRTL (Interrupt Response Time Limit) MSR value to microseconds.
*/
-
-static const unsigned int irtl_ns_units[] __initconst = {
- 1, 32, 1024, 32768, 1048576, 33554432, 0, 0
-};
-
static unsigned long long __init irtl_2_usec(unsigned long long irtl)
{
+ static const unsigned int irtl_ns_units[] __initconst = {
+ 1, 32, 1024, 32768, 1048576, 33554432, 0, 0
+ };
unsigned long long ns;
if (!irtl)
@@ -1309,8 +1310,9 @@ static unsigned long long __init irtl_2_usec(unsigned long long irtl)
ns = irtl_ns_units[(irtl >> 10) & 0x7];
- return div64_u64((irtl & 0x3FF) * ns, 1000);
+ return div_u64((irtl & 0x3FF) * ns, NSEC_PER_USEC);
}
+
/*
* bxt_idle_state_table_update(void)
*