intel_idle: Replace min_t() with the better alternatives
PATCH 1/1 intel_idle: Replace min_t() with the better alternatives
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 <[email protected]>
--- drivers/idle/intel_idle.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/idle/intel_idle.c +3 -5
@@ -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_hstatic 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
Signature · 1 line
2.50.1
Quoted 34 lines · Andy Shevchenko
Almost always use of
min_t()is wrong. Replace it withmin()andmin3()as all types are int and there is no point to use typed variant of it.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/idle/intel_idle.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/idle/intel_idle.c +2
-4@@ -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
drivers/idle/intel_idle.c static bool __init intel_idle_off_by_default_lpi(unsigned int flags, u32 mwait_h
Quoted 9 lines
drivers/idle/intel_idle.c +1
-2@@ -2018,7 +2016,7 @@ static bool __init intel_idle_off_by_default_lpi(unsigned int flags, u32 mwait_hstatic 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 --
Applied as 7.4 material, thanks!