Skip to contentSkip to conversation

thermal: intel: powerclamp: Simplify check_invalid()

PATCH Applied Thorsten Blum 2 participants 2 messages Aug 20 – Sep 4 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: intel: powerclamp: Simplify check_invalid()

Return the boolean expression directly and use const for the read-only mask parameter.

---
 drivers/thermal/intel/intel_powerclamp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +2 -5
index bd7fd98dc310..f54cc6a29d16 100644
@@ -143,12 +143,9 @@ static int allocate_copy_idle_injection_mask(const struct cpumask *copy_mask)
 }
 
 /* Return true if the cpumask and idle percent combination is invalid */
-static bool check_invalid(cpumask_var_t mask, u8 idle)
+static bool check_invalid(const struct cpumask *mask, u8 idle)
 {
-	if (cpumask_equal(cpu_present_mask, mask) && idle > MAX_ALL_CPU_IDLE)
-		return true;
-
-	return false;
+	return cpumask_equal(cpu_present_mask, mask) && idle > MAX_ALL_CPU_IDLE;
 }
 
 static int cpumask_set(const char *arg, const struct kernel_param *kp)
maintainer Applied
#1 lore raw
Quoted 18 lines · Thorsten Blum

Return the boolean expression directly and use const for the read-only mask parameter.

---
 drivers/thermal/intel/intel_powerclamp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +0 -1
index bd7fd98dc310..f54cc6a29d16 100644
@@ -143,12 +143,9 @@ static int allocate_copy_idle_injection_mask(const struct cpumask *copy_mask)
 }
 
 /* Return true if the cpumask and idle percent combination is invalid */
-static bool check_invalid(cpumask_var_t mask, u8 idle)

drivers/thermal/intel/intel_powerclamp.c static int allocate_copy_idle_injection_mask(const struct cpumask *copy_mask) · line 151

Quoted 10 lines
drivers/thermal/intel/intel_powerclamp.c +2 -4
+static bool check_invalid(const struct cpumask *mask, u8 idle)
 {
-       if (cpumask_equal(cpu_present_mask, mask) && idle > MAX_ALL_CPU_IDLE)
-               return true;
-
-       return false;
+       return cpumask_equal(cpu_present_mask, mask) && idle > MAX_ALL_CPU_IDLE;
 }
 
 static int cpumask_set(const char *arg, const struct kernel_param *kp)

Applied as 7.4 material, thanks!