diff mbox series

[03/54] thermal/intel: don't use bitmap_weight() in end_power_clamp()

Message ID 20220123183925.1052919-4-yury.norov@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series None | expand

Commit Message

Yury Norov Jan. 23, 2022, 6:38 p.m. UTC
Don't call bitmap_weight() if the following code can get by
without it.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 drivers/thermal/intel/intel_powerclamp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Rafael J. Wysocki Feb. 4, 2022, 6:29 p.m. UTC | #1
On Sun, Jan 23, 2022 at 7:39 PM Yury Norov <yury.norov@gmail.com> wrote:
>
> Don't call bitmap_weight() if the following code can get by
> without it.
>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
>  drivers/thermal/intel/intel_powerclamp.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
> index 14256421d98c..c841ab37e7c6 100644
> --- a/drivers/thermal/intel/intel_powerclamp.c
> +++ b/drivers/thermal/intel/intel_powerclamp.c
> @@ -556,12 +556,9 @@ static void end_power_clamp(void)
>          * stop faster.
>          */
>         clamping = false;
> -       if (bitmap_weight(cpu_clamping_mask, num_possible_cpus())) {
> -               for_each_set_bit(i, cpu_clamping_mask, num_possible_cpus()) {
> -                       pr_debug("clamping worker for cpu %d alive, destroy\n",
> -                                i);
> -                       stop_power_clamp_worker(i);
> -               }
> +       for_each_set_bit(i, cpu_clamping_mask, num_possible_cpus()) {
> +               pr_debug("clamping worker for cpu %d alive, destroy\n", i);
> +               stop_power_clamp_worker(i);
>         }
>  }
>
> --

Applied as 5.18 material, thanks!
diff mbox series

Patch

diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index 14256421d98c..c841ab37e7c6 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -556,12 +556,9 @@  static void end_power_clamp(void)
 	 * stop faster.
 	 */
 	clamping = false;
-	if (bitmap_weight(cpu_clamping_mask, num_possible_cpus())) {
-		for_each_set_bit(i, cpu_clamping_mask, num_possible_cpus()) {
-			pr_debug("clamping worker for cpu %d alive, destroy\n",
-				 i);
-			stop_power_clamp_worker(i);
-		}
+	for_each_set_bit(i, cpu_clamping_mask, num_possible_cpus()) {
+		pr_debug("clamping worker for cpu %d alive, destroy\n", i);
+		stop_power_clamp_worker(i);
 	}
 }