Skip to content

Commit ded2d38

Browse files
zhang-ruidlezcano
authored andcommitted
thermal/core: Remove thermal_bind_params structure
Remove struct thermal_bind_params because no one is using it for thermal binding now. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230330104526.3196-1-rui.zhang@intel.com
1 parent cdd6076 commit ded2d38

3 files changed

Lines changed: 11 additions & 196 deletions

File tree

Documentation/driver-api/thermal/sysfs-api.rst

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -304,42 +304,6 @@ temperature) and throttle appropriate devices.
304304
1.4 Thermal Zone Parameters
305305
---------------------------
306306

307-
::
308-
309-
struct thermal_bind_params
310-
311-
This structure defines the following parameters that are used to bind
312-
a zone with a cooling device for a particular trip point.
313-
314-
.cdev:
315-
The cooling device pointer
316-
.weight:
317-
The 'influence' of a particular cooling device on this
318-
zone. This is relative to the rest of the cooling
319-
devices. For example, if all cooling devices have a
320-
weight of 1, then they all contribute the same. You can
321-
use percentages if you want, but it's not mandatory. A
322-
weight of 0 means that this cooling device doesn't
323-
contribute to the cooling of this zone unless all cooling
324-
devices have a weight of 0. If all weights are 0, then
325-
they all contribute the same.
326-
.trip_mask:
327-
This is a bit mask that gives the binding relation between
328-
this thermal zone and cdev, for a particular trip point.
329-
If nth bit is set, then the cdev and thermal zone are bound
330-
for trip point n.
331-
.binding_limits:
332-
This is an array of cooling state limits. Must have
333-
exactly 2 * thermal_zone.number_of_trip_points. It is an
334-
array consisting of tuples <lower-state upper-state> of
335-
state limits. Each trip will be associated with one state
336-
limit tuple when binding. A NULL pointer means
337-
<THERMAL_NO_LIMITS THERMAL_NO_LIMITS> on all trips.
338-
These limits are used when binding a cdev to a trip point.
339-
.match:
340-
This call back returns success(0) if the 'tz and cdev' need to
341-
be bound, as per platform data.
342-
343307
::
344308

345309
struct thermal_zone_params
@@ -357,10 +321,6 @@ temperature) and throttle appropriate devices.
357321
will be created. when no_hwmon == true, nothing will be done.
358322
In case the thermal_zone_params is NULL, the hwmon interface
359323
will be created (for backward compatibility).
360-
.num_tbps:
361-
Number of thermal_bind_params entries for this zone
362-
.tbp:
363-
thermal_bind_params entries
364324

365325
2. sysfs attributes structure
366326
=============================

drivers/thermal/thermal_core.c

Lines changed: 11 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -794,62 +794,16 @@ void print_bind_err_msg(struct thermal_zone_device *tz,
794794
tz->type, cdev->type, ret);
795795
}
796796

797-
static void __bind(struct thermal_zone_device *tz, int mask,
798-
struct thermal_cooling_device *cdev,
799-
unsigned long *limits,
800-
unsigned int weight)
801-
{
802-
int i, ret;
803-
804-
for (i = 0; i < tz->num_trips; i++) {
805-
if (mask & (1 << i)) {
806-
unsigned long upper, lower;
807-
808-
upper = THERMAL_NO_LIMIT;
809-
lower = THERMAL_NO_LIMIT;
810-
if (limits) {
811-
lower = limits[i * 2];
812-
upper = limits[i * 2 + 1];
813-
}
814-
ret = thermal_zone_bind_cooling_device(tz, i, cdev,
815-
upper, lower,
816-
weight);
817-
if (ret)
818-
print_bind_err_msg(tz, cdev, ret);
819-
}
820-
}
821-
}
822-
823797
static void bind_cdev(struct thermal_cooling_device *cdev)
824798
{
825-
int i, ret;
826-
const struct thermal_zone_params *tzp;
799+
int ret;
827800
struct thermal_zone_device *pos = NULL;
828801

829802
list_for_each_entry(pos, &thermal_tz_list, node) {
830-
if (!pos->tzp && !pos->ops->bind)
831-
continue;
832-
833803
if (pos->ops->bind) {
834804
ret = pos->ops->bind(pos, cdev);
835805
if (ret)
836806
print_bind_err_msg(pos, cdev, ret);
837-
continue;
838-
}
839-
840-
tzp = pos->tzp;
841-
if (!tzp || !tzp->tbp)
842-
continue;
843-
844-
for (i = 0; i < tzp->num_tbps; i++) {
845-
if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
846-
continue;
847-
if (tzp->tbp[i].match(pos, cdev))
848-
continue;
849-
tzp->tbp[i].cdev = cdev;
850-
__bind(pos, tzp->tbp[i].trip_mask, cdev,
851-
tzp->tbp[i].binding_limits,
852-
tzp->tbp[i].weight);
853807
}
854808
}
855809
}
@@ -1134,16 +1088,6 @@ void thermal_cooling_device_update(struct thermal_cooling_device *cdev)
11341088
}
11351089
EXPORT_SYMBOL_GPL(thermal_cooling_device_update);
11361090

1137-
static void __unbind(struct thermal_zone_device *tz, int mask,
1138-
struct thermal_cooling_device *cdev)
1139-
{
1140-
int i;
1141-
1142-
for (i = 0; i < tz->num_trips; i++)
1143-
if (mask & (1 << i))
1144-
thermal_zone_unbind_cooling_device(tz, i, cdev);
1145-
}
1146-
11471091
/**
11481092
* thermal_cooling_device_unregister - removes a thermal cooling device
11491093
* @cdev: the thermal cooling device to remove.
@@ -1153,8 +1097,6 @@ static void __unbind(struct thermal_zone_device *tz, int mask,
11531097
*/
11541098
void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
11551099
{
1156-
int i;
1157-
const struct thermal_zone_params *tzp;
11581100
struct thermal_zone_device *tz;
11591101

11601102
if (!cdev)
@@ -1171,21 +1113,8 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
11711113

11721114
/* Unbind all thermal zones associated with 'this' cdev */
11731115
list_for_each_entry(tz, &thermal_tz_list, node) {
1174-
if (tz->ops->unbind) {
1116+
if (tz->ops->unbind)
11751117
tz->ops->unbind(tz, cdev);
1176-
continue;
1177-
}
1178-
1179-
if (!tz->tzp || !tz->tzp->tbp)
1180-
continue;
1181-
1182-
tzp = tz->tzp;
1183-
for (i = 0; i < tzp->num_tbps; i++) {
1184-
if (tzp->tbp[i].cdev == cdev) {
1185-
__unbind(tz, tzp->tbp[i].trip_mask, cdev);
1186-
tzp->tbp[i].cdev = NULL;
1187-
}
1188-
}
11891118
}
11901119

11911120
mutex_unlock(&thermal_list_lock);
@@ -1196,41 +1125,20 @@ EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister);
11961125

11971126
static void bind_tz(struct thermal_zone_device *tz)
11981127
{
1199-
int i, ret;
1128+
int ret;
12001129
struct thermal_cooling_device *pos = NULL;
1201-
const struct thermal_zone_params *tzp = tz->tzp;
12021130

1203-
if (!tzp && !tz->ops->bind)
1131+
if (!tz->ops->bind)
12041132
return;
12051133

12061134
mutex_lock(&thermal_list_lock);
12071135

1208-
/* If there is ops->bind, try to use ops->bind */
1209-
if (tz->ops->bind) {
1210-
list_for_each_entry(pos, &thermal_cdev_list, node) {
1211-
ret = tz->ops->bind(tz, pos);
1212-
if (ret)
1213-
print_bind_err_msg(tz, pos, ret);
1214-
}
1215-
goto exit;
1216-
}
1217-
1218-
if (!tzp || !tzp->tbp)
1219-
goto exit;
1220-
12211136
list_for_each_entry(pos, &thermal_cdev_list, node) {
1222-
for (i = 0; i < tzp->num_tbps; i++) {
1223-
if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
1224-
continue;
1225-
if (tzp->tbp[i].match(tz, pos))
1226-
continue;
1227-
tzp->tbp[i].cdev = pos;
1228-
__bind(tz, tzp->tbp[i].trip_mask, pos,
1229-
tzp->tbp[i].binding_limits,
1230-
tzp->tbp[i].weight);
1231-
}
1137+
ret = tz->ops->bind(tz, pos);
1138+
if (ret)
1139+
print_bind_err_msg(tz, pos, ret);
12321140
}
1233-
exit:
1141+
12341142
mutex_unlock(&thermal_list_lock);
12351143
}
12361144

@@ -1487,15 +1395,13 @@ EXPORT_SYMBOL_GPL(thermal_zone_device_id);
14871395
*/
14881396
void thermal_zone_device_unregister(struct thermal_zone_device *tz)
14891397
{
1490-
int i, tz_id;
1491-
const struct thermal_zone_params *tzp;
1398+
int tz_id;
14921399
struct thermal_cooling_device *cdev;
14931400
struct thermal_zone_device *pos = NULL;
14941401

14951402
if (!tz)
14961403
return;
14971404

1498-
tzp = tz->tzp;
14991405
tz_id = tz->id;
15001406

15011407
mutex_lock(&thermal_list_lock);
@@ -1510,22 +1416,9 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
15101416
list_del(&tz->node);
15111417

15121418
/* Unbind all cdevs associated with 'this' thermal zone */
1513-
list_for_each_entry(cdev, &thermal_cdev_list, node) {
1514-
if (tz->ops->unbind) {
1419+
list_for_each_entry(cdev, &thermal_cdev_list, node)
1420+
if (tz->ops->unbind)
15151421
tz->ops->unbind(tz, cdev);
1516-
continue;
1517-
}
1518-
1519-
if (!tzp || !tzp->tbp)
1520-
break;
1521-
1522-
for (i = 0; i < tzp->num_tbps; i++) {
1523-
if (tzp->tbp[i].cdev == cdev) {
1524-
__unbind(tz, tzp->tbp[i].trip_mask, cdev);
1525-
tzp->tbp[i].cdev = NULL;
1526-
}
1527-
}
1528-
}
15291422

15301423
mutex_unlock(&thermal_list_lock);
15311424

include/linux/thermal.h

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -207,41 +207,6 @@ struct thermal_governor {
207207
struct list_head governor_list;
208208
};
209209

210-
/* Structure that holds binding parameters for a zone */
211-
struct thermal_bind_params {
212-
struct thermal_cooling_device *cdev;
213-
214-
/*
215-
* This is a measure of 'how effectively these devices can
216-
* cool 'this' thermal zone. It shall be determined by
217-
* platform characterization. This value is relative to the
218-
* rest of the weights so a cooling device whose weight is
219-
* double that of another cooling device is twice as
220-
* effective. See Documentation/driver-api/thermal/sysfs-api.rst for more
221-
* information.
222-
*/
223-
int weight;
224-
225-
/*
226-
* This is a bit mask that gives the binding relation between this
227-
* thermal zone and cdev, for a particular trip point.
228-
* See Documentation/driver-api/thermal/sysfs-api.rst for more information.
229-
*/
230-
int trip_mask;
231-
232-
/*
233-
* This is an array of cooling state limits. Must have exactly
234-
* 2 * thermal_zone.number_of_trip_points. It is an array consisting
235-
* of tuples <lower-state upper-state> of state limits. Each trip
236-
* will be associated with one state limit tuple when binding.
237-
* A NULL pointer means <THERMAL_NO_LIMITS THERMAL_NO_LIMITS>
238-
* on all trips.
239-
*/
240-
unsigned long *binding_limits;
241-
int (*match) (struct thermal_zone_device *tz,
242-
struct thermal_cooling_device *cdev);
243-
};
244-
245210
/* Structure to define Thermal Zone parameters */
246211
struct thermal_zone_params {
247212
char governor_name[THERMAL_NAME_LENGTH];
@@ -253,9 +218,6 @@ struct thermal_zone_params {
253218
*/
254219
bool no_hwmon;
255220

256-
int num_tbps; /* Number of tbp entries */
257-
struct thermal_bind_params *tbp;
258-
259221
/*
260222
* Sustainable power (heat) that this thermal zone can dissipate in
261223
* mW

0 commit comments

Comments
 (0)