[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200407174926.23971-9-andrzej.p@collabora.com>
Date: Tue, 7 Apr 2020 19:49:26 +0200
From: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
To: linux-pm@...r.kernel.org
Cc: Zhang Rui <rui.zhang@...el.com>,
"Rafael J . Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>, Jiri Pirko <jiri@...lanox.com>,
Ido Schimmel <idosch@...lanox.com>,
"David S . Miller" <davem@...emloft.net>,
Peter Kaestle <peter@...e.net>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Support Opensource <support.opensource@...semi.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Amit Kucheria <amit.kucheria@...durent.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Allison Randal <allison@...utok.net>,
Enrico Weigelt <info@...ux.net>,
Gayatri Kammela <gayatri.kammela@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-acpi@...r.kernel.org, netdev@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, kernel@...labora.com,
Andrzej Pietrasiewicz <andrzej.p@...labora.com>
Subject: [RFC 8/8] thermal: Stop polling DISABLED thermal devices
Polling DISABLED devices is not desired, as all such "disabled" devices
are meant to be handled by userspace.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
---
drivers/thermal/thermal_core.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index aae2b049d45c..f74b7a792be7 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -305,13 +305,32 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
cancel_delayed_work(&tz->poll_queue);
}
+static bool should_stop_polling(struct thermal_zone_device *tz)
+{
+ enum thermal_device_mode mode;
+ int result;
+
+ if (!tz->ops->get_mode)
+ return false;
+
+ result = tz->ops->get_mode(tz, &mode);
+ if (result)
+ return false;
+
+ return mode == THERMAL_DEVICE_DISABLED;
+}
+
static void monitor_thermal_zone(struct thermal_zone_device *tz)
{
+ bool stop;
+
+ stop = should_stop_polling(tz);
+
mutex_lock(&tz->lock);
- if (tz->passive)
+ if (!stop && tz->passive)
thermal_zone_device_set_polling(tz, tz->passive_delay);
- else if (tz->polling_delay)
+ else if (!stop && tz->polling_delay)
thermal_zone_device_set_polling(tz, tz->polling_delay);
else
thermal_zone_device_set_polling(tz, 0);
@@ -500,6 +519,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz,
{
int count;
+ if (should_stop_polling(tz))
+ return;
+
if (atomic_read(&in_suspend))
return;
--
2.17.1
Powered by blists - more mailing lists