[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251120-thermal-device-v1-1-bbdad594d57a@gmx.de>
Date: Thu, 20 Nov 2025 04:41:11 +0100
From: Armin Wolf <W_Armin@....de>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>, Zhang Rui <rui.zhang@...el.com>,
Lukasz Luba <lukasz.luba@....com>, Len Brown <lenb@...nel.org>,
Jonathan Corbet <corbet@....net>, Ido Schimmel <idosch@...dia.com>,
Petr Machata <petrm@...dia.com>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
etnaviv@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-tegra@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-doc@...r.kernel.org, netdev@...r.kernel.org,
linux-wireless@...r.kernel.org, ath10k@...ts.infradead.org,
ath11k@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, platform-driver-x86@...r.kernel.org,
linux-pci@...r.kernel.org, imx@...ts.linux.dev,
linux-renesas-soc@...r.kernel.org
Subject: [PATCH RFC RESEND 1/8] thermal: core: Allow setting the parent
device of cooling devices
Currently, cooling devices have no parent device, potentially causing
issues with suspend ordering and making it impossible for consumers
(thermal zones and userspace appications) to associate a given cooling
device with its parent device.
Extend __thermal_cooling_device_register() to also accept a parent
device pointer. For now only devm_thermal_of_cooling_device_register()
uses this, as the other wrapper functions need to be extended first.
Signed-off-by: Armin Wolf <W_Armin@....de>
---
drivers/thermal/thermal_core.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 17ca5c082643..c8b720194b44 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1040,6 +1040,7 @@ static void thermal_cooling_device_init_complete(struct thermal_cooling_device *
/**
* __thermal_cooling_device_register() - register a new thermal cooling device
+ * @parent: parent device pointer.
* @np: a pointer to a device tree node.
* @type: the thermal cooling device type.
* @devdata: device private data.
@@ -1055,7 +1056,7 @@ static void thermal_cooling_device_init_complete(struct thermal_cooling_device *
* ERR_PTR. Caller must check return value with IS_ERR*() helpers.
*/
static struct thermal_cooling_device *
-__thermal_cooling_device_register(struct device_node *np,
+__thermal_cooling_device_register(struct device *parent, struct device_node *np,
const char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)
{
@@ -1092,6 +1093,7 @@ __thermal_cooling_device_register(struct device_node *np,
cdev->ops = ops;
cdev->updated = false;
cdev->device.class = thermal_class;
+ cdev->device.parent = parent;
cdev->devdata = devdata;
ret = cdev->ops->get_max_state(cdev, &cdev->max_state);
@@ -1158,7 +1160,7 @@ struct thermal_cooling_device *
thermal_cooling_device_register(const char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)
{
- return __thermal_cooling_device_register(NULL, type, devdata, ops);
+ return __thermal_cooling_device_register(NULL, NULL, type, devdata, ops);
}
EXPORT_SYMBOL_GPL(thermal_cooling_device_register);
@@ -1182,7 +1184,7 @@ thermal_of_cooling_device_register(struct device_node *np,
const char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)
{
- return __thermal_cooling_device_register(np, type, devdata, ops);
+ return __thermal_cooling_device_register(NULL, np, type, devdata, ops);
}
EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register);
@@ -1222,7 +1224,7 @@ devm_thermal_of_cooling_device_register(struct device *dev,
if (!ptr)
return ERR_PTR(-ENOMEM);
- tcd = __thermal_cooling_device_register(np, type, devdata, ops);
+ tcd = __thermal_cooling_device_register(dev, np, type, devdata, ops);
if (IS_ERR(tcd)) {
devres_free(ptr);
return tcd;
--
2.39.5
Powered by blists - more mailing lists