Skip to content

Commit 976cb65

Browse files
committed
Merge tag 'generic-trip-point' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux
Pull thermal control updates for 6.3 from Daniel Lezcano: "- Rework a large bunch of drivers to use the generic thermal trip structure and the opportunity to do more cleanups by removing unused functions in the OF code (Daniel Lezcano). - Fix some locking issues related to the generic thermal trip rework (Johan Hovold). - Fix a crash when requesting the critical temperature on tegra, this fix is related to the generic trip point (Jon Hunter). - Use strscpy() to instead of strncpy() (Xu Panda)." * tag 'generic-trip-point' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (37 commits) thermal/drivers/armada: Use strscpy() to instead of strncpy() thermal/drivers/qcom: Fix lock inversion thermal/drivers/tegra: Fix set_trip_temp() deadlock thermal/drivers/qcom: Fix set_trip_temp() deadlock thermal/drivers/mellanox: Use generic thermal_zone_get_trip() function wifi: iwlwifi: Use generic thermal_zone_get_trip() function thermal/drivers/tegra: Fix crash when getting critical temp thermal/drivers/exynos: Fix NULL pointer dereference when getting the critical temp thermal/drivers/intel: Use generic thermal_zone_get_trip() function thermal/intel/int340x: Replace parameter to simplify thermal/drivers/cxgb4: Use generic thermal_zone_get_trip() function thermal/drivers/acerhdf: Use generic thermal_zone_get_trip() function thermal/drivers/ti: Remove unused macros ti_thermal_get_trip_value() / ti_thermal_trip_is_valid() thermal/drivers/da9062: Use generic thermal_zone_get_trip() function thermal/drivers/broadcom: Use generic thermal_zone_get_trip() function thermal/drivers/rcar: Use generic thermal_zone_get_trip() function thermal/drivers/imx: Use generic thermal_zone_get_trip() function thermal/drivers/st: Use generic trip points thermal/of: Remove of_thermal_get_crit_temp() thermal/of: Remove of_thermal_set_trip_hyst() ...
2 parents b878d3b + 3a15149 commit 976cb65

35 files changed

+618
-1046
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,8 +1079,6 @@ struct mbox_list {
10791079
#if IS_ENABLED(CONFIG_THERMAL)
10801080
struct ch_thermal {
10811081
struct thermal_zone_device *tzdev;
1082-
int trip_temp;
1083-
int trip_type;
10841082
};
10851083
#endif
10861084

drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,12 @@ static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev,
2929
return 0;
3030
}
3131

32-
static int cxgb4_thermal_get_trip_type(struct thermal_zone_device *tzdev,
33-
int trip, enum thermal_trip_type *type)
34-
{
35-
struct adapter *adap = tzdev->devdata;
36-
37-
if (!adap->ch_thermal.trip_temp)
38-
return -EINVAL;
39-
40-
*type = adap->ch_thermal.trip_type;
41-
return 0;
42-
}
43-
44-
static int cxgb4_thermal_get_trip_temp(struct thermal_zone_device *tzdev,
45-
int trip, int *temp)
46-
{
47-
struct adapter *adap = tzdev->devdata;
48-
49-
if (!adap->ch_thermal.trip_temp)
50-
return -EINVAL;
51-
52-
*temp = adap->ch_thermal.trip_temp;
53-
return 0;
54-
}
55-
5632
static struct thermal_zone_device_ops cxgb4_thermal_ops = {
5733
.get_temp = cxgb4_thermal_get_temp,
58-
.get_trip_type = cxgb4_thermal_get_trip_type,
59-
.get_trip_temp = cxgb4_thermal_get_trip_temp,
6034
};
6135

36+
static struct thermal_trip trip = { .type = THERMAL_TRIP_CRITICAL } ;
37+
6238
int cxgb4_thermal_init(struct adapter *adap)
6339
{
6440
struct ch_thermal *ch_thermal = &adap->ch_thermal;
@@ -79,15 +55,14 @@ int cxgb4_thermal_init(struct adapter *adap)
7955
if (ret < 0) {
8056
num_trip = 0; /* could not get trip temperature */
8157
} else {
82-
ch_thermal->trip_temp = val * 1000;
83-
ch_thermal->trip_type = THERMAL_TRIP_CRITICAL;
58+
trip.temperature = val * 1000;
8459
}
8560

8661
snprintf(ch_tz_name, sizeof(ch_tz_name), "cxgb4_%s", adap->name);
87-
ch_thermal->tzdev = thermal_zone_device_register(ch_tz_name, num_trip,
88-
0, adap,
89-
&cxgb4_thermal_ops,
90-
NULL, 0, 0);
62+
ch_thermal->tzdev = thermal_zone_device_register_with_trips(ch_tz_name, &trip, num_trip,
63+
0, adap,
64+
&cxgb4_thermal_ops,
65+
NULL, 0, 0);
9166
if (IS_ERR(ch_thermal->tzdev)) {
9267
ret = PTR_ERR(ch_thermal->tzdev);
9368
dev_err(adap->pdev_dev, "Failed to register thermal zone\n");

0 commit comments

Comments
 (0)