mediatek: copy patches-6.1 to patches-6.6
[openwrt/staging/stintel.git] / target / linux / mediatek / patches-6.6 / 830-v6.4-10-thermal-core-Add-thermal_zone_device-structure-type-.patch
1 From 072e35c98806100182c0a7263cf4cba09ce43463 Mon Sep 17 00:00:00 2001
2 From: Daniel Lezcano <daniel.lezcano@linaro.org>
3 Date: Wed, 1 Mar 2023 21:14:38 +0100
4 Subject: [PATCH] thermal/core: Add thermal_zone_device structure 'type'
5 accessor
6
7 The thermal zone device structure is exposed via the exported
8 thermal.h header. This structure should stay private the thermal core
9 code. In order to encapsulate the structure, let's add an accessor to
10 get the 'type' of the thermal zone.
11
12 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
13 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
14 ---
15 drivers/thermal/thermal_core.c | 6 ++++++
16 include/linux/thermal.h | 6 ++++++
17 2 files changed, 12 insertions(+)
18
19 --- a/drivers/thermal/thermal_core.c
20 +++ b/drivers/thermal/thermal_core.c
21 @@ -1352,6 +1352,12 @@ void *thermal_zone_device_priv(struct th
22 }
23 EXPORT_SYMBOL_GPL(thermal_zone_device_priv);
24
25 +const char *thermal_zone_device_type(struct thermal_zone_device *tzd)
26 +{
27 + return tzd->type;
28 +}
29 +EXPORT_SYMBOL_GPL(thermal_zone_device_type);
30 +
31 /**
32 * thermal_zone_device_unregister - removes the registered thermal zone device
33 * @tz: the thermal zone device to remove
34 --- a/include/linux/thermal.h
35 +++ b/include/linux/thermal.h
36 @@ -347,6 +347,7 @@ thermal_zone_device_register_with_trips(
37 struct thermal_zone_params *, int, int);
38
39 void *thermal_zone_device_priv(struct thermal_zone_device *tzd);
40 +const char *thermal_zone_device_type(struct thermal_zone_device *tzd);
41
42 int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
43 struct thermal_cooling_device *,
44 @@ -423,6 +424,11 @@ static inline void *thermal_zone_device_
45 {
46 return NULL;
47 }
48 +
49 +static inline const char *thermal_zone_device_type(struct thermal_zone_device *tzd)
50 +{
51 + return NULL;
52 +}
53
54 static inline int thermal_zone_device_enable(struct thermal_zone_device *tz)
55 { return -ENODEV; }