From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
Len Brown <lenb@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] intel_idle: Replace min_t() with the better alternatives
Date: Thu, 13 Aug 2026 10:17:21 +0200 [thread overview]
Message-ID: <20260813081721.2645937-1-andriy.shevchenko@linux.intel.com> (raw)
Almost always use of min_t() is wrong. Replace it with min() and min3() as all
types are int and there is no point to use typed variant of it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/idle/intel_idle.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index b12b4f62752a..699665f24ecd 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1792,9 +1792,7 @@ static bool __init intel_idle_cst_usable(void)
{
int cstate, limit;
- limit = min_t(int, min_t(int, CPUIDLE_STATE_MAX, max_cstate + 1),
- acpi_state_table.count);
-
+ limit = min3(CPUIDLE_STATE_MAX, max_cstate + 1, acpi_state_table.count);
for (cstate = 1; cstate < limit; cstate++) {
struct acpi_processor_cx *cx = &acpi_state_table.states[cstate];
@@ -1938,7 +1936,7 @@ static void __init intel_idle_init_cstates_acpi_lpi(struct cpuidle_driver *drv)
static void __init intel_idle_init_cstates_acpi_cst(struct cpuidle_driver *drv)
{
- int cstate, limit = min_t(int, CPUIDLE_STATE_MAX, acpi_state_table.count);
+ int cstate, limit = min(CPUIDLE_STATE_MAX, acpi_state_table.count);
/*
* If limit > 0, intel_idle_cst_usable() has returned 'true', so all of
@@ -2018,7 +2016,7 @@ static bool __init intel_idle_off_by_default_lpi(unsigned int flags, u32 mwait_h
static bool __init intel_idle_off_by_default_cst(unsigned int flags, u32 mwait_hint)
{
- int cstate, limit = min_t(int, CPUIDLE_STATE_MAX, acpi_state_table.count);
+ int cstate, limit = min(CPUIDLE_STATE_MAX, acpi_state_table.count);
/*
* If limit > 0, intel_idle_cst_usable() has returned 'true', so all of
--
2.50.1
reply other threads:[~2026-08-13 8:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260813081721.2645937-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
/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
all inboxes | Powered by JetHome®