mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] thermal/governors/step_wise: delete obsolete comment
@ 2023-03-21  5:47 Zhang Rui
  2023-03-21  5:47 ` [PATCH 2/2] thermal/governors/step_wise: Adjust code logic to align with the comment Zhang Rui
  2023-04-27 17:07 ` [PATCH 1/2] thermal/governors/step_wise: delete obsolete comment Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Rui @ 2023-03-21  5:47 UTC (permalink / raw)
  To: linux-pm, rafael.j.wysocki, daniel.lezcano; +Cc: linux-kernel

Commit 4102c4042a33 ("thermal/core: Remove DROP_FULL and RAISE_FULL")
removes support for THERMAL_TREND_RAISE_FULL/DROP_FULL but leaves the
comment unchanged.

Delete the obsolte comment about THERMAL_TREND_RAISE_FULL/DROP_FULL.

Fixes: 4102c4042a33 ("thermal/core: Remove DROP_FULL and RAISE_FULL")
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/gov_step_wise.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
index 31235e169c5a..7a760b6a4279 100644
--- a/drivers/thermal/gov_step_wise.c
+++ b/drivers/thermal/gov_step_wise.c
@@ -21,19 +21,11 @@
  *    a. if the trend is THERMAL_TREND_RAISING, use higher cooling
  *       state for this trip point
  *    b. if the trend is THERMAL_TREND_DROPPING, do nothing
- *    c. if the trend is THERMAL_TREND_RAISE_FULL, use upper limit
- *       for this trip point
- *    d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit
- *       for this trip point
  * If the temperature is lower than a trip point,
  *    a. if the trend is THERMAL_TREND_RAISING, do nothing
  *    b. if the trend is THERMAL_TREND_DROPPING, use lower cooling
  *       state for this trip point, if the cooling state already
  *       equals lower limit, deactivate the thermal instance
- *    c. if the trend is THERMAL_TREND_RAISE_FULL, do nothing
- *    d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit,
- *       if the cooling state already equals lower limit,
- *       deactivate the thermal instance
  */
 static unsigned long get_target_state(struct thermal_instance *instance,
 				enum thermal_trend trend, bool throttle)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] thermal/governors/step_wise: Adjust code logic to align with the comment
  2023-03-21  5:47 [PATCH 1/2] thermal/governors/step_wise: delete obsolete comment Zhang Rui
@ 2023-03-21  5:47 ` Zhang Rui
  2023-04-27 17:07 ` [PATCH 1/2] thermal/governors/step_wise: delete obsolete comment Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2023-03-21  5:47 UTC (permalink / raw)
  To: linux-pm, rafael.j.wysocki, daniel.lezcano; +Cc: linux-kernel

For the algorithm of choosing the next target state in step_wise
governor, the code does the right thing but is implemented in a
way different from what the comment describes. And this hurts the code
readability.

As the logic in the comment is simpler, adjust the code logic to align
with the comment.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/gov_step_wise.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
index 7a760b6a4279..318b38d04eb9 100644
--- a/drivers/thermal/gov_step_wise.c
+++ b/drivers/thermal/gov_step_wise.c
@@ -53,24 +53,16 @@ static unsigned long get_target_state(struct thermal_instance *instance,
 		return next_target;
 	}
 
-	switch (trend) {
-	case THERMAL_TREND_RAISING:
-		if (throttle) {
+	if (throttle) {
+		if (trend == THERMAL_TREND_RAISING)
 			next_target = clamp((cur_state + 1), instance->lower, instance->upper);
-		}
-		break;
-	case THERMAL_TREND_DROPPING:
-		if (cur_state <= instance->lower) {
-			if (!throttle)
+	} else {
+		if (trend == THERMAL_TREND_DROPPING) {
+			if (cur_state <= instance->lower)
 				next_target = THERMAL_NO_TARGET;
-		} else {
-			if (!throttle) {
+			else
 				next_target = clamp((cur_state - 1), instance->lower, instance->upper);
-			}
 		}
-		break;
-	default:
-		break;
 	}
 
 	return next_target;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] thermal/governors/step_wise: delete obsolete comment
  2023-03-21  5:47 [PATCH 1/2] thermal/governors/step_wise: delete obsolete comment Zhang Rui
  2023-03-21  5:47 ` [PATCH 2/2] thermal/governors/step_wise: Adjust code logic to align with the comment Zhang Rui
@ 2023-04-27 17:07 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2023-04-27 17:07 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-pm, rafael.j.wysocki, daniel.lezcano, linux-kernel

On Tue, Mar 21, 2023 at 6:47 AM Zhang Rui <rui.zhang@intel.com> wrote:
>
> Commit 4102c4042a33 ("thermal/core: Remove DROP_FULL and RAISE_FULL")
> removes support for THERMAL_TREND_RAISE_FULL/DROP_FULL but leaves the
> comment unchanged.
>
> Delete the obsolte comment about THERMAL_TREND_RAISE_FULL/DROP_FULL.
>
> Fixes: 4102c4042a33 ("thermal/core: Remove DROP_FULL and RAISE_FULL")
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/thermal/gov_step_wise.c | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
> index 31235e169c5a..7a760b6a4279 100644
> --- a/drivers/thermal/gov_step_wise.c
> +++ b/drivers/thermal/gov_step_wise.c
> @@ -21,19 +21,11 @@
>   *    a. if the trend is THERMAL_TREND_RAISING, use higher cooling
>   *       state for this trip point
>   *    b. if the trend is THERMAL_TREND_DROPPING, do nothing
> - *    c. if the trend is THERMAL_TREND_RAISE_FULL, use upper limit
> - *       for this trip point
> - *    d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit
> - *       for this trip point
>   * If the temperature is lower than a trip point,
>   *    a. if the trend is THERMAL_TREND_RAISING, do nothing
>   *    b. if the trend is THERMAL_TREND_DROPPING, use lower cooling
>   *       state for this trip point, if the cooling state already
>   *       equals lower limit, deactivate the thermal instance
> - *    c. if the trend is THERMAL_TREND_RAISE_FULL, do nothing
> - *    d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit,
> - *       if the cooling state already equals lower limit,
> - *       deactivate the thermal instance
>   */
>  static unsigned long get_target_state(struct thermal_instance *instance,
>                                 enum thermal_trend trend, bool throttle)
> --

Applied as 6.4-rc material along with the [2/2], thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-27 17:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21  5:47 [PATCH 1/2] thermal/governors/step_wise: delete obsolete comment Zhang Rui
2023-03-21  5:47 ` [PATCH 2/2] thermal/governors/step_wise: Adjust code logic to align with the comment Zhang Rui
2023-04-27 17:07 ` [PATCH 1/2] thermal/governors/step_wise: delete obsolete comment Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®