mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 12:16:41 +00:00
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
This commit is contained in:
parent
cdd6076b0a
commit
ded2d383b1
@ -304,42 +304,6 @@ temperature) and throttle appropriate devices.
|
|||||||
1.4 Thermal Zone Parameters
|
1.4 Thermal Zone Parameters
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
struct thermal_bind_params
|
|
||||||
|
|
||||||
This structure defines the following parameters that are used to bind
|
|
||||||
a zone with a cooling device for a particular trip point.
|
|
||||||
|
|
||||||
.cdev:
|
|
||||||
The cooling device pointer
|
|
||||||
.weight:
|
|
||||||
The 'influence' of a particular cooling device on this
|
|
||||||
zone. This is relative to the rest of the cooling
|
|
||||||
devices. For example, if all cooling devices have a
|
|
||||||
weight of 1, then they all contribute the same. You can
|
|
||||||
use percentages if you want, but it's not mandatory. A
|
|
||||||
weight of 0 means that this cooling device doesn't
|
|
||||||
contribute to the cooling of this zone unless all cooling
|
|
||||||
devices have a weight of 0. If all weights are 0, then
|
|
||||||
they all contribute the same.
|
|
||||||
.trip_mask:
|
|
||||||
This is a bit mask that gives the binding relation between
|
|
||||||
this thermal zone and cdev, for a particular trip point.
|
|
||||||
If nth bit is set, then the cdev and thermal zone are bound
|
|
||||||
for trip point n.
|
|
||||||
.binding_limits:
|
|
||||||
This is an array of cooling state limits. Must have
|
|
||||||
exactly 2 * thermal_zone.number_of_trip_points. It is an
|
|
||||||
array consisting of tuples <lower-state upper-state> of
|
|
||||||
state limits. Each trip will be associated with one state
|
|
||||||
limit tuple when binding. A NULL pointer means
|
|
||||||
<THERMAL_NO_LIMITS THERMAL_NO_LIMITS> on all trips.
|
|
||||||
These limits are used when binding a cdev to a trip point.
|
|
||||||
.match:
|
|
||||||
This call back returns success(0) if the 'tz and cdev' need to
|
|
||||||
be bound, as per platform data.
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
struct thermal_zone_params
|
struct thermal_zone_params
|
||||||
@ -357,10 +321,6 @@ temperature) and throttle appropriate devices.
|
|||||||
will be created. when no_hwmon == true, nothing will be done.
|
will be created. when no_hwmon == true, nothing will be done.
|
||||||
In case the thermal_zone_params is NULL, the hwmon interface
|
In case the thermal_zone_params is NULL, the hwmon interface
|
||||||
will be created (for backward compatibility).
|
will be created (for backward compatibility).
|
||||||
.num_tbps:
|
|
||||||
Number of thermal_bind_params entries for this zone
|
|
||||||
.tbp:
|
|
||||||
thermal_bind_params entries
|
|
||||||
|
|
||||||
2. sysfs attributes structure
|
2. sysfs attributes structure
|
||||||
=============================
|
=============================
|
||||||
|
@ -794,62 +794,16 @@ void print_bind_err_msg(struct thermal_zone_device *tz,
|
|||||||
tz->type, cdev->type, ret);
|
tz->type, cdev->type, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __bind(struct thermal_zone_device *tz, int mask,
|
|
||||||
struct thermal_cooling_device *cdev,
|
|
||||||
unsigned long *limits,
|
|
||||||
unsigned int weight)
|
|
||||||
{
|
|
||||||
int i, ret;
|
|
||||||
|
|
||||||
for (i = 0; i < tz->num_trips; i++) {
|
|
||||||
if (mask & (1 << i)) {
|
|
||||||
unsigned long upper, lower;
|
|
||||||
|
|
||||||
upper = THERMAL_NO_LIMIT;
|
|
||||||
lower = THERMAL_NO_LIMIT;
|
|
||||||
if (limits) {
|
|
||||||
lower = limits[i * 2];
|
|
||||||
upper = limits[i * 2 + 1];
|
|
||||||
}
|
|
||||||
ret = thermal_zone_bind_cooling_device(tz, i, cdev,
|
|
||||||
upper, lower,
|
|
||||||
weight);
|
|
||||||
if (ret)
|
|
||||||
print_bind_err_msg(tz, cdev, ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bind_cdev(struct thermal_cooling_device *cdev)
|
static void bind_cdev(struct thermal_cooling_device *cdev)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int ret;
|
||||||
const struct thermal_zone_params *tzp;
|
|
||||||
struct thermal_zone_device *pos = NULL;
|
struct thermal_zone_device *pos = NULL;
|
||||||
|
|
||||||
list_for_each_entry(pos, &thermal_tz_list, node) {
|
list_for_each_entry(pos, &thermal_tz_list, node) {
|
||||||
if (!pos->tzp && !pos->ops->bind)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pos->ops->bind) {
|
if (pos->ops->bind) {
|
||||||
ret = pos->ops->bind(pos, cdev);
|
ret = pos->ops->bind(pos, cdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
print_bind_err_msg(pos, cdev, ret);
|
print_bind_err_msg(pos, cdev, ret);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
tzp = pos->tzp;
|
|
||||||
if (!tzp || !tzp->tbp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (i = 0; i < tzp->num_tbps; i++) {
|
|
||||||
if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
|
|
||||||
continue;
|
|
||||||
if (tzp->tbp[i].match(pos, cdev))
|
|
||||||
continue;
|
|
||||||
tzp->tbp[i].cdev = cdev;
|
|
||||||
__bind(pos, tzp->tbp[i].trip_mask, cdev,
|
|
||||||
tzp->tbp[i].binding_limits,
|
|
||||||
tzp->tbp[i].weight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1134,16 +1088,6 @@ void thermal_cooling_device_update(struct thermal_cooling_device *cdev)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(thermal_cooling_device_update);
|
EXPORT_SYMBOL_GPL(thermal_cooling_device_update);
|
||||||
|
|
||||||
static void __unbind(struct thermal_zone_device *tz, int mask,
|
|
||||||
struct thermal_cooling_device *cdev)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < tz->num_trips; i++)
|
|
||||||
if (mask & (1 << i))
|
|
||||||
thermal_zone_unbind_cooling_device(tz, i, cdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* thermal_cooling_device_unregister - removes a thermal cooling device
|
* thermal_cooling_device_unregister - removes a thermal cooling device
|
||||||
* @cdev: the thermal cooling device to remove.
|
* @cdev: the thermal cooling device to remove.
|
||||||
@ -1153,8 +1097,6 @@ static void __unbind(struct thermal_zone_device *tz, int mask,
|
|||||||
*/
|
*/
|
||||||
void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
|
void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
const struct thermal_zone_params *tzp;
|
|
||||||
struct thermal_zone_device *tz;
|
struct thermal_zone_device *tz;
|
||||||
|
|
||||||
if (!cdev)
|
if (!cdev)
|
||||||
@ -1171,21 +1113,8 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
|
|||||||
|
|
||||||
/* Unbind all thermal zones associated with 'this' cdev */
|
/* Unbind all thermal zones associated with 'this' cdev */
|
||||||
list_for_each_entry(tz, &thermal_tz_list, node) {
|
list_for_each_entry(tz, &thermal_tz_list, node) {
|
||||||
if (tz->ops->unbind) {
|
if (tz->ops->unbind)
|
||||||
tz->ops->unbind(tz, cdev);
|
tz->ops->unbind(tz, cdev);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tz->tzp || !tz->tzp->tbp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
tzp = tz->tzp;
|
|
||||||
for (i = 0; i < tzp->num_tbps; i++) {
|
|
||||||
if (tzp->tbp[i].cdev == cdev) {
|
|
||||||
__unbind(tz, tzp->tbp[i].trip_mask, cdev);
|
|
||||||
tzp->tbp[i].cdev = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&thermal_list_lock);
|
mutex_unlock(&thermal_list_lock);
|
||||||
@ -1196,41 +1125,20 @@ EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister);
|
|||||||
|
|
||||||
static void bind_tz(struct thermal_zone_device *tz)
|
static void bind_tz(struct thermal_zone_device *tz)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int ret;
|
||||||
struct thermal_cooling_device *pos = NULL;
|
struct thermal_cooling_device *pos = NULL;
|
||||||
const struct thermal_zone_params *tzp = tz->tzp;
|
|
||||||
|
|
||||||
if (!tzp && !tz->ops->bind)
|
if (!tz->ops->bind)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mutex_lock(&thermal_list_lock);
|
mutex_lock(&thermal_list_lock);
|
||||||
|
|
||||||
/* If there is ops->bind, try to use ops->bind */
|
|
||||||
if (tz->ops->bind) {
|
|
||||||
list_for_each_entry(pos, &thermal_cdev_list, node) {
|
|
||||||
ret = tz->ops->bind(tz, pos);
|
|
||||||
if (ret)
|
|
||||||
print_bind_err_msg(tz, pos, ret);
|
|
||||||
}
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tzp || !tzp->tbp)
|
|
||||||
goto exit;
|
|
||||||
|
|
||||||
list_for_each_entry(pos, &thermal_cdev_list, node) {
|
list_for_each_entry(pos, &thermal_cdev_list, node) {
|
||||||
for (i = 0; i < tzp->num_tbps; i++) {
|
ret = tz->ops->bind(tz, pos);
|
||||||
if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
|
if (ret)
|
||||||
continue;
|
print_bind_err_msg(tz, pos, ret);
|
||||||
if (tzp->tbp[i].match(tz, pos))
|
|
||||||
continue;
|
|
||||||
tzp->tbp[i].cdev = pos;
|
|
||||||
__bind(tz, tzp->tbp[i].trip_mask, pos,
|
|
||||||
tzp->tbp[i].binding_limits,
|
|
||||||
tzp->tbp[i].weight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exit:
|
|
||||||
mutex_unlock(&thermal_list_lock);
|
mutex_unlock(&thermal_list_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1487,15 +1395,13 @@ EXPORT_SYMBOL_GPL(thermal_zone_device_id);
|
|||||||
*/
|
*/
|
||||||
void thermal_zone_device_unregister(struct thermal_zone_device *tz)
|
void thermal_zone_device_unregister(struct thermal_zone_device *tz)
|
||||||
{
|
{
|
||||||
int i, tz_id;
|
int tz_id;
|
||||||
const struct thermal_zone_params *tzp;
|
|
||||||
struct thermal_cooling_device *cdev;
|
struct thermal_cooling_device *cdev;
|
||||||
struct thermal_zone_device *pos = NULL;
|
struct thermal_zone_device *pos = NULL;
|
||||||
|
|
||||||
if (!tz)
|
if (!tz)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tzp = tz->tzp;
|
|
||||||
tz_id = tz->id;
|
tz_id = tz->id;
|
||||||
|
|
||||||
mutex_lock(&thermal_list_lock);
|
mutex_lock(&thermal_list_lock);
|
||||||
@ -1510,22 +1416,9 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
|
|||||||
list_del(&tz->node);
|
list_del(&tz->node);
|
||||||
|
|
||||||
/* Unbind all cdevs associated with 'this' thermal zone */
|
/* Unbind all cdevs associated with 'this' thermal zone */
|
||||||
list_for_each_entry(cdev, &thermal_cdev_list, node) {
|
list_for_each_entry(cdev, &thermal_cdev_list, node)
|
||||||
if (tz->ops->unbind) {
|
if (tz->ops->unbind)
|
||||||
tz->ops->unbind(tz, cdev);
|
tz->ops->unbind(tz, cdev);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tzp || !tzp->tbp)
|
|
||||||
break;
|
|
||||||
|
|
||||||
for (i = 0; i < tzp->num_tbps; i++) {
|
|
||||||
if (tzp->tbp[i].cdev == cdev) {
|
|
||||||
__unbind(tz, tzp->tbp[i].trip_mask, cdev);
|
|
||||||
tzp->tbp[i].cdev = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_unlock(&thermal_list_lock);
|
mutex_unlock(&thermal_list_lock);
|
||||||
|
|
||||||
|
@ -207,41 +207,6 @@ struct thermal_governor {
|
|||||||
struct list_head governor_list;
|
struct list_head governor_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Structure that holds binding parameters for a zone */
|
|
||||||
struct thermal_bind_params {
|
|
||||||
struct thermal_cooling_device *cdev;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a measure of 'how effectively these devices can
|
|
||||||
* cool 'this' thermal zone. It shall be determined by
|
|
||||||
* platform characterization. This value is relative to the
|
|
||||||
* rest of the weights so a cooling device whose weight is
|
|
||||||
* double that of another cooling device is twice as
|
|
||||||
* effective. See Documentation/driver-api/thermal/sysfs-api.rst for more
|
|
||||||
* information.
|
|
||||||
*/
|
|
||||||
int weight;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a bit mask that gives the binding relation between this
|
|
||||||
* thermal zone and cdev, for a particular trip point.
|
|
||||||
* See Documentation/driver-api/thermal/sysfs-api.rst for more information.
|
|
||||||
*/
|
|
||||||
int trip_mask;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is an array of cooling state limits. Must have exactly
|
|
||||||
* 2 * thermal_zone.number_of_trip_points. It is an array consisting
|
|
||||||
* of tuples <lower-state upper-state> of state limits. Each trip
|
|
||||||
* will be associated with one state limit tuple when binding.
|
|
||||||
* A NULL pointer means <THERMAL_NO_LIMITS THERMAL_NO_LIMITS>
|
|
||||||
* on all trips.
|
|
||||||
*/
|
|
||||||
unsigned long *binding_limits;
|
|
||||||
int (*match) (struct thermal_zone_device *tz,
|
|
||||||
struct thermal_cooling_device *cdev);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Structure to define Thermal Zone parameters */
|
/* Structure to define Thermal Zone parameters */
|
||||||
struct thermal_zone_params {
|
struct thermal_zone_params {
|
||||||
char governor_name[THERMAL_NAME_LENGTH];
|
char governor_name[THERMAL_NAME_LENGTH];
|
||||||
@ -253,9 +218,6 @@ struct thermal_zone_params {
|
|||||||
*/
|
*/
|
||||||
bool no_hwmon;
|
bool no_hwmon;
|
||||||
|
|
||||||
int num_tbps; /* Number of tbp entries */
|
|
||||||
struct thermal_bind_params *tbp;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sustainable power (heat) that this thermal zone can dissipate in
|
* Sustainable power (heat) that this thermal zone can dissipate in
|
||||||
* mW
|
* mW
|
||||||
|
Loading…
Reference in New Issue
Block a user