From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Len Brown <len.brown@intel.com>, Zhang Rui <rui.zhang@intel.com>,
Rafael Wysocki <rafael@kernel.org>
Subject: [PATCH 8/8][update] intel_idle: Clean up irtl_2_usec()
Date: Wed, 15 Jan 2020 00:00:55 +0100 [thread overview]
Message-ID: <2321946.4oVt5DIM6V@kreacher> (raw)
In-Reply-To: <43884200.5FZKizBWDr@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
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>
---
The original patch went a bit too far with dropping the local variable
in irtl_2_usec(), so retain it and also document the function argument
in the kerneldoc.
---
drivers/idle/intel_idle.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 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,16 +1292,17 @@ 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.
+ * @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_
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)
*
prev parent reply other threads:[~2020-01-14 23:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 10:42 [PATCH 0/8] intel_idle: Assorted cleanups Rafael J. Wysocki
2020-01-10 10:43 ` [PATCH 1/8] intel_idle: Eliminate __setup_broadcast_timer() Rafael J. Wysocki
2020-01-10 10:44 ` [PATCH 2/8] intel_idle: Fold intel_idle_probe() into intel_idle_init() Rafael J. Wysocki
2020-01-10 10:45 ` [PATCH 3/8] intel_idle: Clean up NULL pointer check in intel_idle_init() Rafael J. Wysocki
2020-01-10 10:48 ` [PATCH 4/8] intel_idle: Rearrange intel_idle_cpuidle_driver_init() Rafael J. Wysocki
2020-01-10 10:49 ` [PATCH 5/8] intel_idle: Move and clean up intel_idle_cpuidle_devices_uninit() Rafael J. Wysocki
2020-01-10 10:51 ` [PATCH 6/8] intel_idle: Annotate initialization code and data structures Rafael J. Wysocki
2020-01-10 10:52 ` [PATCH 7/8] intel_idle: Move 3 functions closer to their callers Rafael J. Wysocki
2020-01-10 10:53 ` [PATCH 8/8] intel_idle: Clean up irtl_2_usec() Rafael J. Wysocki
2020-01-14 23:00 ` Rafael J. Wysocki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2321946.4oVt5DIM6V@kreacher \
--to=rjw@rjwysocki.net \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).