From: Armin Wolf <W_Armin@gmx.de>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
"Daniel Lezcano" <daniel.lezcano@linaro.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Lukasz Luba" <lukasz.luba@arm.com>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Russell King" <linux+etnaviv@armlinux.org.uk>,
"Christian Gmeiner" <christian.gmeiner@gmail.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Amit Daniel Kachhap" <amit.kachhap@gmail.com>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"Len Brown" <lenb@kernel.org>, "Jonathan Corbet" <corbet@lwn.net>,
"Ido Schimmel" <idosch@nvidia.com>,
"Petr Machata" <petrm@nvidia.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Jeff Johnson" <jjohnson@kernel.org>,
"Miri Korenblit" <miriam.rachel.korenblit@intel.com>,
"Felix Fietkau" <nbd@nbd.name>,
"Lorenzo Bianconi" <lorenzo@kernel.org>,
"Ryder Lee" <ryder.lee@mediatek.com>,
"Shayne Chen" <shayne.chen@mediatek.com>,
"Sean Wang" <sean.wang@mediatek.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Peter Kaestle" <peter@piie.net>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Potnuri Bharat Teja" <bharat@chelsio.com>,
"Sebastian Reichel" <sre@kernel.org>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Support Opensource" <support.opensource@diasemi.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-tegra@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-doc@vger.kernel.org, netdev@vger.kernel.org,
linux-wireless@vger.kernel.org, ath10k@lists.infradead.org,
ath11k@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org,
imx@lists.linux.dev, linux-renesas-soc@vger.kernel.org
Subject: [PATCH RFC 1/8] thermal: core: Allow setting the parent device of cooling devices
Date: Fri, 14 Nov 2025 04:23:02 +0100 [thread overview]
Message-ID: <20251114-thermal-device-v1-1-d8b442aae38b@gmx.de> (raw)
In-Reply-To: <20251114-thermal-device-v1-0-d8b442aae38b@gmx.de>
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@gmx.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
next prev parent reply other threads:[~2025-11-14 3:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 3:23 [PATCH RFC 0/8] thermal: core: Allow setting the parent device of thermal zone/cooling devices Armin Wolf
2025-11-14 3:23 ` Armin Wolf [this message]
2025-11-14 3:23 ` [PATCH RFC 2/8] thermal: core: Set parent device in thermal_of_cooling_device_register() Armin Wolf
2025-11-14 3:23 ` [PATCH RFC 3/8] ACPI: processor: Stop creating "device" sysfs link Armin Wolf
2025-11-14 12:13 ` [PATCH RFC 0/8] thermal: core: Allow setting the parent device of thermal zone/cooling devices Rafael J. Wysocki
2025-11-14 20:10 ` Rafael J. Wysocki
2025-11-15 20:07 ` Armin Wolf
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=20251114-thermal-device-v1-1-d8b442aae38b@gmx.de \
--to=w_armin@gmx.de \
--cc=airlied@gmail.com \
--cc=amit.kachhap@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=ath10k@lists.infradead.org \
--cc=ath11k@lists.infradead.org \
--cc=bharat@chelsio.com \
--cc=christian.gmeiner@gmail.com \
--cc=corbet@lwn.net \
--cc=daniel.lezcano@linaro.org \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=etnaviv@lists.freedesktop.org \
--cc=festevam@gmail.com \
--cc=geert+renesas@glider.be \
--cc=hansg@kernel.org \
--cc=idosch@nvidia.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=imx@lists.linux.dev \
--cc=jjohnson@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=l.stach@pengutronix.de \
--cc=lenb@kernel.org \
--cc=linux+etnaviv@armlinux.org.uk \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=lukasz.luba@arm.com \
--cc=magnus.damm@gmail.com \
--cc=matthias.bgg@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=miriam.rachel.korenblit@intel.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=pabeni@redhat.com \
--cc=peter@piie.net \
--cc=petrm@nvidia.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=ryder.lee@mediatek.com \
--cc=s.hauer@pengutronix.de \
--cc=sean.wang@mediatek.com \
--cc=shawnguo@kernel.org \
--cc=shayne.chen@mediatek.com \
--cc=simona@ffwll.ch \
--cc=sre@kernel.org \
--cc=support.opensource@diasemi.com \
--cc=thierry.reding@gmail.com \
--cc=viresh.kumar@linaro.org \
/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®