[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200629111615.18131-10-andrzej.p@collabora.com>
Date: Mon, 29 Jun 2020 13:16:13 +0200
From: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
To: linux-pm@...r.kernel.org, linux-acpi@...r.kernel.org,
netdev@...r.kernel.org, linux-wireless@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-renesas-soc@...r.kernel.org,
linux-rockchip@...ts.infradead.org
Cc: "Rafael J . Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>,
Vishal Kulkarni <vishal@...lsio.com>,
"David S . Miller" <davem@...emloft.net>,
Jiri Pirko <jiri@...lanox.com>,
Ido Schimmel <idosch@...lanox.com>,
Johannes Berg <johannes.berg@...el.com>,
Emmanuel Grumbach <emmanuel.grumbach@...el.com>,
Luca Coelho <luciano.coelho@...el.com>,
Intel Linux Wireless <linuxwifi@...el.com>,
Kalle Valo <kvalo@...eaurora.org>,
Peter Kaestle <peter@...e.net>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Sebastian Reichel <sre@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Amit Kucheria <amit.kucheria@...durent.com>,
Support Opensource <support.opensource@...semi.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>,
Niklas Söderlund <niklas.soderlund@...natech.se>,
Heiko Stuebner <heiko@...ech.de>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang7@...il.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
Zhang Rui <rui.zhang@...el.com>,
Allison Randal <allison@...utok.net>,
Enrico Weigelt <info@...ux.net>,
Gayatri Kammela <gayatri.kammela@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Andrzej Pietrasiewicz <andrzej.p@...labora.com>,
kernel@...labora.com
Subject: [PATCH v6 09/11] thermal: core: Stop polling DISABLED thermal devices
Polling DISABLED devices is not desired, as all such "disabled" devices
are meant to be handled by userspace. This patch introduces and uses
should_stop_polling() to decide whether the device should be polled or not.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
---
drivers/thermal/thermal_core.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 52d136780577..e613f5c07bad 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -301,13 +301,22 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
cancel_delayed_work(&tz->poll_queue);
}
+static inline bool should_stop_polling(struct thermal_zone_device *tz)
+{
+ return !thermal_zone_device_is_enabled(tz);
+}
+
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);
@@ -517,6 +526,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