@@ -29,36 +29,12 @@ static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev,
29
29
return 0 ;
30
30
}
31
31
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
-
56
32
static struct thermal_zone_device_ops cxgb4_thermal_ops = {
57
33
.get_temp = cxgb4_thermal_get_temp ,
58
- .get_trip_type = cxgb4_thermal_get_trip_type ,
59
- .get_trip_temp = cxgb4_thermal_get_trip_temp ,
60
34
};
61
35
36
+ static struct thermal_trip trip = { .type = THERMAL_TRIP_CRITICAL } ;
37
+
62
38
int cxgb4_thermal_init (struct adapter * adap )
63
39
{
64
40
struct ch_thermal * ch_thermal = & adap -> ch_thermal ;
@@ -79,15 +55,14 @@ int cxgb4_thermal_init(struct adapter *adap)
79
55
if (ret < 0 ) {
80
56
num_trip = 0 ; /* could not get trip temperature */
81
57
} else {
82
- ch_thermal -> trip_temp = val * 1000 ;
83
- ch_thermal -> trip_type = THERMAL_TRIP_CRITICAL ;
58
+ trip .temperature = val * 1000 ;
84
59
}
85
60
86
61
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 );
91
66
if (IS_ERR (ch_thermal -> tzdev )) {
92
67
ret = PTR_ERR (ch_thermal -> tzdev );
93
68
dev_err (adap -> pdev_dev , "Failed to register thermal zone\n" );
0 commit comments