lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <561441f1-3e96-4979-bc55-6296179760ed@piie.net>
Date: Tue, 13 Aug 2024 23:03:43 +0200
From: Peter Kästle <peter@...e.net>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
 Linux PM <linux-pm@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Lukasz Luba <lukasz.luba@....com>,
 Daniel Lezcano <daniel.lezcano@...aro.org>, Zhang Rui <rui.zhang@...el.com>,
 Peter Kästle <peter@...e.net>
Subject: Re: [PATCH v1 2/4] thermal: gov_bang_bang: Split bang_bang_control()

On 13.08.24 16:26, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> Move the setting of the thermal instance target state from
> bang_bang_control() into a separate function that will be also called
> in a different place going forward.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

Acked-by: Peter Kästle <peter@...e.net>

> ---
>   drivers/thermal/gov_bang_bang.c |   42 +++++++++++++++++++++-------------------
>   1 file changed, 23 insertions(+), 19 deletions(-)
> 
> Index: linux-pm/drivers/thermal/gov_bang_bang.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/gov_bang_bang.c
> +++ linux-pm/drivers/thermal/gov_bang_bang.c
> @@ -13,6 +13,27 @@
>   
>   #include "thermal_core.h"
>   
> +static void bang_bang_set_instance_target(struct thermal_instance *instance,
> +					  unsigned int target)
> +{
> +	if (instance->target != 0 && instance->target != 1 &&
> +	    instance->target != THERMAL_NO_TARGET)
> +		pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n",
> +			 instance->target, instance->name);
> +
> +	/*
> +	 * Enable the fan when the trip is crossed on the way up and disable it
> +	 * when the trip is crossed on the way down.
> +	 */
> +	instance->target = target;
> +
> +	dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);
> +
> +	mutex_lock(&instance->cdev->lock);
> +	__thermal_cdev_update(instance->cdev);
> +	mutex_unlock(&instance->cdev->lock);
> +}
> +
>   /**
>    * bang_bang_control - controls devices associated with the given zone
>    * @tz: thermal_zone_device
> @@ -54,25 +75,8 @@ static void bang_bang_control(struct the
>   		tz->temperature, trip->hysteresis);
>   
>   	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
> -		if (instance->trip != trip)
> -			continue;
> -
> -		if (instance->target != 0 && instance->target != 1 &&
> -		    instance->target != THERMAL_NO_TARGET)
> -			pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n",
> -				 instance->target, instance->name);
> -
> -		/*
> -		 * Enable the fan when the trip is crossed on the way up and
> -		 * disable it when the trip is crossed on the way down.
> -		 */
> -		instance->target = crossed_up;
> -
> -		dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);
> -
> -		mutex_lock(&instance->cdev->lock);
> -		__thermal_cdev_update(instance->cdev);
> -		mutex_unlock(&instance->cdev->lock);
> +		if (instance->trip == trip)
> +			bang_bang_set_instance_target(instance, crossed_up);
>   	}
>   }
>   
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ