mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Lukasz Luba <lukasz.luba@arm.com>
Subject: [PATCH v2 2/2] thermal: core: Add sanity check for polling_delay and passive_delay
Date: Fri, 05 Jul 2024 21:46:26 +0200	[thread overview]
Message-ID: <4940808.31r3eYUQgx@rjwysocki.net> (raw)
In-Reply-To: <2746673.mvXUDI8C0e@rjwysocki.net>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

If polling_delay is nonzero and passive_delay is 0, the thermal zone
will use polling except when tz->passive is nonzero, which does not make
sense.

Also if polling_delay is nonzero and passive_delay is greater than
polling_delay, the thermal zone temperature will be updated less often
when tz->passive is nonzero.  This does not make sense either.

Ensure that none of the above will happen.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

v1 -> v2: The patch actually matches the changelog

---
 drivers/thermal/thermal_core.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-pm/drivers/thermal/thermal_core.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.c
+++ linux-pm/drivers/thermal/thermal_core.c
@@ -1440,6 +1440,9 @@ thermal_zone_device_register_with_trips(
 		td->threshold = INT_MAX;
 	}
 
+	if (polling_delay && (passive_delay > polling_delay || !passive_delay))
+		passive_delay = polling_delay;
+
 	thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay);
 	thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay);
 




  parent reply	other threads:[~2024-07-05 19:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-05 19:43 [PATCH v2 0/2] thermal: core: Sanitize polling delay values Rafael J. Wysocki
2024-07-05 19:44 ` [PATCH v2 1/2] thermal: core: Change passive_delay and polling_delay data type Rafael J. Wysocki
2024-07-08 10:23   ` Daniel Lezcano
2024-07-05 19:46 ` Rafael J. Wysocki [this message]
2024-07-08 12:06   ` [PATCH v2 2/2] thermal: core: Add sanity check for polling_delay and passive_delay Daniel Lezcano
2024-07-08 13:38     ` Rafael J. Wysocki
2024-07-08 13:58       ` Daniel Lezcano
2024-07-08 14:03         ` Rafael J. Wysocki
2024-07-08 14:32           ` Daniel Lezcano
2024-07-08 15:11             ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4940808.31r3eYUQgx@rjwysocki.net \
    --to=rjw@rjwysocki.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®