@@ -18,9 +18,6 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
18
18
unsigned long long tmp ;
19
19
acpi_status status ;
20
20
21
- if (d -> override_ops && d -> override_ops -> get_temp )
22
- return d -> override_ops -> get_temp (zone , temp );
23
-
24
21
status = acpi_evaluate_integer (d -> adev -> handle , "_TMP" , NULL , & tmp );
25
22
if (ACPI_FAILURE (status ))
26
23
return - EIO ;
@@ -46,9 +43,6 @@ static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone,
46
43
struct int34x_thermal_zone * d = zone -> devdata ;
47
44
int i ;
48
45
49
- if (d -> override_ops && d -> override_ops -> get_trip_temp )
50
- return d -> override_ops -> get_trip_temp (zone , trip , temp );
51
-
52
46
if (trip < d -> aux_trip_nr )
53
47
* temp = d -> aux_trips [trip ];
54
48
else if (trip == d -> crt_trip_id )
@@ -79,9 +73,6 @@ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone,
79
73
struct int34x_thermal_zone * d = zone -> devdata ;
80
74
int i ;
81
75
82
- if (d -> override_ops && d -> override_ops -> get_trip_type )
83
- return d -> override_ops -> get_trip_type (zone , trip , type );
84
-
85
76
if (trip < d -> aux_trip_nr )
86
77
* type = THERMAL_TRIP_PASSIVE ;
87
78
else if (trip == d -> crt_trip_id )
@@ -112,9 +103,6 @@ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
112
103
acpi_status status ;
113
104
char name [10 ];
114
105
115
- if (d -> override_ops && d -> override_ops -> set_trip_temp )
116
- return d -> override_ops -> set_trip_temp (zone , trip , temp );
117
-
118
106
snprintf (name , sizeof (name ), "PAT%d" , trip );
119
107
status = acpi_execute_simple_method (d -> adev -> handle , name ,
120
108
millicelsius_to_deci_kelvin (temp ));
@@ -134,9 +122,6 @@ static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone,
134
122
acpi_status status ;
135
123
unsigned long long hyst ;
136
124
137
- if (d -> override_ops && d -> override_ops -> get_trip_hyst )
138
- return d -> override_ops -> get_trip_hyst (zone , trip , temp );
139
-
140
125
status = acpi_evaluate_integer (d -> adev -> handle , "GTSH" , NULL , & hyst );
141
126
if (ACPI_FAILURE (status ))
142
127
* temp = 0 ;
@@ -217,7 +202,7 @@ static struct thermal_zone_params int340x_thermal_params = {
217
202
};
218
203
219
204
struct int34x_thermal_zone * int340x_thermal_zone_add (struct acpi_device * adev ,
220
- struct thermal_zone_device_ops * override_ops )
205
+ int ( * get_temp ) ( struct thermal_zone_device * , int * ) )
221
206
{
222
207
struct int34x_thermal_zone * int34x_thermal_zone ;
223
208
acpi_status status ;
@@ -231,7 +216,16 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
231
216
return ERR_PTR (- ENOMEM );
232
217
233
218
int34x_thermal_zone -> adev = adev ;
234
- int34x_thermal_zone -> override_ops = override_ops ;
219
+
220
+ int34x_thermal_zone -> ops = kmemdup (& int340x_thermal_zone_ops ,
221
+ sizeof (int340x_thermal_zone_ops ), GFP_KERNEL );
222
+ if (!int34x_thermal_zone -> ops ) {
223
+ ret = - ENOMEM ;
224
+ goto err_ops_alloc ;
225
+ }
226
+
227
+ if (get_temp )
228
+ int34x_thermal_zone -> ops -> get_temp = get_temp ;
235
229
236
230
status = acpi_evaluate_integer (adev -> handle , "PATC" , NULL , & trip_cnt );
237
231
if (ACPI_FAILURE (status ))
@@ -262,7 +256,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
262
256
acpi_device_bid (adev ),
263
257
trip_cnt ,
264
258
trip_mask , int34x_thermal_zone ,
265
- & int340x_thermal_zone_ops ,
259
+ int34x_thermal_zone -> ops ,
266
260
& int340x_thermal_params ,
267
261
0 , 0 );
268
262
if (IS_ERR (int34x_thermal_zone -> zone )) {
@@ -281,6 +275,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
281
275
acpi_lpat_free_conversion_table (int34x_thermal_zone -> lpat_table );
282
276
kfree (int34x_thermal_zone -> aux_trips );
283
277
err_trip_alloc :
278
+ kfree (int34x_thermal_zone -> ops );
279
+ err_ops_alloc :
284
280
kfree (int34x_thermal_zone );
285
281
return ERR_PTR (ret );
286
282
}
@@ -292,6 +288,7 @@ void int340x_thermal_zone_remove(struct int34x_thermal_zone
292
288
thermal_zone_device_unregister (int34x_thermal_zone -> zone );
293
289
acpi_lpat_free_conversion_table (int34x_thermal_zone -> lpat_table );
294
290
kfree (int34x_thermal_zone -> aux_trips );
291
+ kfree (int34x_thermal_zone -> ops );
295
292
kfree (int34x_thermal_zone );
296
293
}
297
294
EXPORT_SYMBOL_GPL (int340x_thermal_zone_remove );
0 commit comments