lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <43884200.5FZKizBWDr@kreacher>
Date:   Fri, 10 Jan 2020 11:53:49 +0100
From:   "Rafael J. Wysocki" <rjw@...ysocki.net>
To:     Linux PM <linux-pm@...r.kernel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Len Brown <len.brown@...el.com>,
        Zhang Rui <rui.zhang@...el.com>
Subject: [PATCH 8/8] intel_idle: Clean up irtl_2_usec()

From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

Move the irtl_ns_units[] definition into irtl_2_usec() which is the
only user of it, drop the ns local variable from irtl_2_usec() as it
is not really necessary in there, use div_u64() for the division in
there as the divisor is small enough and use the NSEC_PER_USEC symbol
for the divisor.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
 drivers/idle/intel_idle.c |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

Index: linux-pm/drivers/idle/intel_idle.c
===================================================================
--- linux-pm.orig/drivers/idle/intel_idle.c
+++ linux-pm/drivers/idle/intel_idle.c
@@ -1292,25 +1292,24 @@ static void __init ivt_idle_state_table_
 	/* 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.
+ *
+ * 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)
 {
-	unsigned long long ns;
+	static const unsigned int irtl_ns_units[] __initconst = {
+		1, 32, 1024, 32768, 1048576, 33554432, 0, 0
+	};
 
 	if (!irtl)
 		return 0;
 
-	ns = irtl_ns_units[(irtl >> 10) & 0x7];
-
-	return div64_u64((irtl & 0x3FF) * ns, 1000);
+	return div_u64((irtl & 0x3FF) * irtl_ns_units[(irtl >> 10) & 0x7],
+		       NSEC_PER_USEC);
 }
+
 /*
  * bxt_idle_state_table_update(void)
  *



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ