@@ -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-
5632static 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+
6238int 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