Skip to content

Commit a2c81dc

Browse files
committed
Merge back thermal control material for 6.3.
2 parents 6c54b7b + 976cb65 commit a2c81dc

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)