[PATCH] thermal: intel: powerclamp: Simplify check_invalid()

Thorsten Blum posted 1 patch 1 month, 1 week ago
drivers/thermal/intel/intel_powerclamp.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
[PATCH] thermal: intel: powerclamp: Simplify check_invalid()
Posted by Thorsten Blum 1 month, 1 week ago
Return the boolean expression directly and use const for the read-only
mask parameter.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/thermal/intel/intel_powerclamp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index bd7fd98dc310..f54cc6a29d16 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -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)
Re: [PATCH] thermal: intel: powerclamp: Simplify check_invalid()
Posted by Rafael J. Wysocki (Intel) 3 weeks, 3 days ago
On Thu, Aug 20, 2026 at 5:44 PM Thorsten Blum <blum@kernel.org> wrote:
>
> Return the boolean expression directly and use const for the read-only
> mask parameter.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
> ---
>  drivers/thermal/intel/intel_powerclamp.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
> index bd7fd98dc310..f54cc6a29d16 100644
> --- a/drivers/thermal/intel/intel_powerclamp.c
> +++ b/drivers/thermal/intel/intel_powerclamp.c
> @@ -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)

Applied as 7.4 material, thanks!