summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@oss.qualcomm.com>2026-05-26 16:08:09 +0200
committerDaniel Lezcano <daniel.lezcano@kernel.org>2026-06-03 09:12:56 +0200
commit3570cb58e3171c8a65d2cedc0371ed412e0caff6 (patch)
treeab5c73d8eb3f64e18e1ee1495189476db2c0c992 /include/linux
parent37324803f049bee0d2b97941e3fbdf35db9a66b3 (diff)
thermal/of: Pass cdev_id and introduce devm registration helper
Extend the OF cooling device registration to support an explicit cooling device identifier (cdev_id), preparing for upcoming DT bindings where cooling devices are identified by a tuple (device node, id) instead of relying on child nodes. Introduce a new helper: devm_thermal_of_cooling_device_register() which registers a cooling device using the device's of_node and an explicit cdev_id. This complements the existing devm_thermal_of_child_cooling_device_register() helper, which remains dedicated to the legacy child-node based bindings. Internally, factorize the devm registration logic into a common helper to avoid code duplication. Existing users are unaffected, as the child-based helper continues to pass a default cdev_id of 0, preserving current behavior. This change is a preparatory step for supporting indexed cooling devices in thermal OF bindings. Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org> Link: https://patch.msgid.link/20260526140802.1059293-20-daniel.lezcano@oss.qualcomm.com
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/thermal.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index fb7649439dfa..81be6e6061b3 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -207,6 +207,11 @@ thermal_of_cooling_device_register(struct device_node *np, u32 cdev_id,
const struct thermal_cooling_device_ops *ops);
struct thermal_cooling_device *
+devm_thermal_of_cooling_device_register(struct device *dev, u32 cdev_id,
+ const char *type, void *devdata,
+ const struct thermal_cooling_device_ops *ops);
+
+struct thermal_cooling_device *
devm_thermal_of_child_cooling_device_register(struct device *dev,
struct device_node *np,
const char *type, void *devdata,
@@ -234,6 +239,14 @@ thermal_of_cooling_device_register(struct device_node *np, u32 cdev_id,
}
static inline struct thermal_cooling_device *
+devm_thermal_of_cooling_device_register(struct device *dev, u32 cdev_id,
+ const char *type, void *devdata,
+ const struct thermal_cooling_device_ops *ops)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline struct thermal_cooling_device *
devm_thermal_of_child_cooling_device_register(struct device *dev,
struct device_node *np,
const char *type, void *devdata,