From: Rafael J. Wysocki <[email protected]>
Do the following cleanups in thermal_zone_trip_update():
* Drop the useless "zero hysteresis" message.
* Eliminate the trip_index local variable that is redundant.
* Drop 2 comments that are not useful.
* Downgrade a diagnostic message from pr_warn() to pr_debug().
* Use consistent field formatting in diagnostic messages.
Signed-off-by: Rafael J. Wysocki <[email protected]>
---
drivers/thermal/gov_bang_bang.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 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
@@ -17,29 +17,23 @@ static void thermal_zone_trip_update(str
const struct thermal_trip *trip,
bool crossed_up)
{
- int trip_index = thermal_zone_trip_id(tz, trip);
struct thermal_instance *instance;
- if (!trip->hysteresis)
- dev_info_once(&tz->device,
- "Zero hysteresis value for thermal zone %s\n", tz->type);
-
dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n",
- trip_index, trip->temperature, tz->temperature,
- trip->hysteresis);
+ thermal_zone_trip_id(tz, trip), trip->temperature,
+ tz->temperature, trip->hysteresis);
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
if (instance->trip != trip)
continue;
- /* in case fan is in initial state, switch the fan off */
if (instance->target == THERMAL_NO_TARGET)
instance->target = 0;
- /* in case fan is neither on nor off set the fan to active */
if (instance->target != 0 && instance->target != 1) {
- pr_warn("Thermal instance %s controlled by bang-bang has unexpected state: %ld\n",
- instance->name, instance->target);
+ pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n",
+ instance->target, instance->name);
+
instance->target = 1;
}
@@ -52,8 +46,7 @@ static void thermal_zone_trip_update(str
else if (instance->target == 1 && !crossed_up)
instance->target = 0;
- dev_dbg(&instance->cdev->device, "target=%d\n",
- (int)instance->target);
+ dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);
mutex_lock(&instance->cdev->lock);
instance->cdev->updated = false; /* cdev needs update */
On 4/10/24 17:05, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <[email protected]>
>
> Do the following cleanups in thermal_zone_trip_update():
>
> * Drop the useless "zero hysteresis" message.
> * Eliminate the trip_index local variable that is redundant.
> * Drop 2 comments that are not useful.
> * Downgrade a diagnostic message from pr_warn() to pr_debug().
> * Use consistent field formatting in diagnostic messages.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>
> ---
> drivers/thermal/gov_bang_bang.c | 19 ++++++-------------
> 1 file changed, 6 insertions(+), 13 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
> @@ -17,29 +17,23 @@ static void thermal_zone_trip_update(str
> const struct thermal_trip *trip,
> bool crossed_up)
> {
> - int trip_index = thermal_zone_trip_id(tz, trip);
> struct thermal_instance *instance;
>
> - if (!trip->hysteresis)
> - dev_info_once(&tz->device,
> - "Zero hysteresis value for thermal zone %s\n", tz->type);
> -
> dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n",
> - trip_index, trip->temperature, tz->temperature,
> - trip->hysteresis);
> + thermal_zone_trip_id(tz, trip), trip->temperature,
> + tz->temperature, trip->hysteresis);
>
> list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
> if (instance->trip != trip)
> continue;
>
> - /* in case fan is in initial state, switch the fan off */
> if (instance->target == THERMAL_NO_TARGET)
> instance->target = 0;
>
> - /* in case fan is neither on nor off set the fan to active */
> if (instance->target != 0 && instance->target != 1) {
> - pr_warn("Thermal instance %s controlled by bang-bang has unexpected state: %ld\n",
> - instance->name, instance->target);
> + pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n",
> + instance->target, instance->name);
> +
> instance->target = 1;
> }
>
> @@ -52,8 +46,7 @@ static void thermal_zone_trip_update(str
> else if (instance->target == 1 && !crossed_up)
> instance->target = 0;
>
> - dev_dbg(&instance->cdev->device, "target=%d\n",
> - (int)instance->target);
> + dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);
>
> mutex_lock(&instance->cdev->lock);
> instance->cdev->updated = false; /* cdev needs update */
>
>
>
LGTM
Reviewed-by: Lukasz Luba <[email protected]>
On 10/04/2024 18:05, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <[email protected]>
>
> Do the following cleanups in thermal_zone_trip_update():
>
> * Drop the useless "zero hysteresis" message.
> * Eliminate the trip_index local variable that is redundant.
> * Drop 2 comments that are not useful.
> * Downgrade a diagnostic message from pr_warn() to pr_debug().
> * Use consistent field formatting in diagnostic messages.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>
> ---
Acked-by: Daniel Lezcano <[email protected]>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog