OpenWrt – Diff between revs 2 and 3

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 2 Rev 3
Line 77... Line 77...
77 - if (!data->ops->get_trend) 77 - if (!data->ops->get_trend)
78 + if (!data->ops->get_trend || (data->mode == THERMAL_DEVICE_DISABLED)) 78 + if (!data->ops->get_trend || (data->mode == THERMAL_DEVICE_DISABLED))
79 return -EINVAL; 79 return -EINVAL;
Line 80... Line 80...
80 80
81 return data->ops->get_trend(data->sensor_data, trip, trend); 81 return data->ops->get_trend(data->sensor_data, trip, trend);
82 @@ -289,7 +293,9 @@ static int of_thermal_set_mode(struct th 82 @@ -286,7 +290,9 @@ static int of_thermal_set_mode(struct th
Line 83... Line 83...
83 mutex_unlock(&tz->lock); 83 mutex_unlock(&tz->lock);
84 84
85 data->mode = mode; 85 data->mode = mode;
86 - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); 86 - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
87 + 87 +
Line 88... Line 88...
88 + if (mode == THERMAL_DEVICE_ENABLED) 88 + if (mode == THERMAL_DEVICE_ENABLED)
89 + thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); 89 + thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
90 90
91 return 0; 91 return 0;
92 } 92 }
Line 93... Line 93...
93 @@ -299,7 +305,8 @@ static int of_thermal_get_trip_type(stru 93 @@ -296,7 +302,8 @@ static int of_thermal_get_trip_type(stru
94 { 94 {
95 struct __thermal_zone *data = tz->devdata; 95 struct __thermal_zone *data = tz->devdata;
96 96
Line 97... Line 97...
97 - if (trip >= data->ntrips || trip < 0) 97 - if (trip >= data->ntrips || trip < 0)
98 + if (trip >= data->ntrips || trip < 0 98 + if (trip >= data->ntrips || trip < 0
99 + || (data->mode == THERMAL_DEVICE_DISABLED)) 99 + || (data->mode == THERMAL_DEVICE_DISABLED))
100 return -EDOM; 100 return -EDOM;
Line 101... Line 101...
101 101
102 *type = data->trips[trip].type; 102 *type = data->trips[trip].type;
Line 139... Line 139...
139 + if (trip >= data->ntrips || trip < 0 139 + if (trip >= data->ntrips || trip < 0
140 + || (data->mode == THERMAL_DEVICE_DISABLED)) 140 + || (data->mode == THERMAL_DEVICE_DISABLED))
141 return -EDOM; 141 return -EDOM;
Line 142... Line 142...
142 142
143 *temp = data->trips[trip].temperature; 143 *temp = data->trips[trip].temperature;
144 @@ -325,7 +359,8 @@ static int of_thermal_set_trip_temp(stru 144 @@ -322,7 +356,8 @@ static int of_thermal_set_trip_temp(stru
145 { 145 {
Line 146... Line 146...
146 struct __thermal_zone *data = tz->devdata; 146 struct __thermal_zone *data = tz->devdata;
147 147
148 - if (trip >= data->ntrips || trip < 0) 148 - if (trip >= data->ntrips || trip < 0)
149 + if (trip >= data->ntrips || trip < 0 149 + if (trip >= data->ntrips || trip < 0
Line 150... Line 150...
150 + || (data->mode == THERMAL_DEVICE_DISABLED)) 150 + || (data->mode == THERMAL_DEVICE_DISABLED))
151 return -EDOM; 151 return -EDOM;
152 152
153 if (data->ops->set_trip_temp) { 153 if (data->ops->set_trip_temp) {
Line 154... Line 154...
154 @@ -347,7 +382,8 @@ static int of_thermal_get_trip_hyst(stru 154 @@ -344,7 +379,8 @@ static int of_thermal_get_trip_hyst(stru
155 { 155 {
156 struct __thermal_zone *data = tz->devdata; 156 struct __thermal_zone *data = tz->devdata;
157 157
Line 158... Line 158...
158 - if (trip >= data->ntrips || trip < 0) 158 - if (trip >= data->ntrips || trip < 0)
159 + if (trip >= data->ntrips || trip < 0 159 + if (trip >= data->ntrips || trip < 0
160 + || (data->mode == THERMAL_DEVICE_DISABLED)) 160 + || (data->mode == THERMAL_DEVICE_DISABLED))
161 return -EDOM; 161 return -EDOM;
Line 162... Line 162...
162 162
163 *hyst = data->trips[trip].hysteresis; 163 *hyst = data->trips[trip].hysteresis;
164 @@ -360,7 +396,8 @@ static int of_thermal_set_trip_hyst(stru 164 @@ -357,7 +393,8 @@ static int of_thermal_set_trip_hyst(stru
165 { 165 {
Line 166... Line 166...
166 struct __thermal_zone *data = tz->devdata; 166 struct __thermal_zone *data = tz->devdata;
167 167
168 - if (trip >= data->ntrips || trip < 0) 168 - if (trip >= data->ntrips || trip < 0)
169 + if (trip >= data->ntrips || trip < 0 169 + if (trip >= data->ntrips || trip < 0
Line 170... Line 170...
170 + || (data->mode == THERMAL_DEVICE_DISABLED)) 170 + || (data->mode == THERMAL_DEVICE_DISABLED))
171 return -EDOM; 171 return -EDOM;
172 172
173 /* thermal framework should take care of data->mask & (1 << trip) */ 173 /* thermal framework should take care of data->mask & (1 << trip) */
Line 174... Line 174...
174 @@ -435,6 +472,9 @@ thermal_zone_of_add_sensor(struct device 174 @@ -432,6 +469,9 @@ thermal_zone_of_add_sensor(struct device
175 if (ops->set_emul_temp) 175 if (ops->set_emul_temp)
176 tzd->ops->set_emul_temp = of_thermal_set_emul_temp; 176 tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
177 177
178 + if (ops->set_trip_activate) 178 + if (ops->set_trip_activate)
179 + tzd->ops->set_trip_activate = of_thermal_activate_trip_type; 179 + tzd->ops->set_trip_activate = of_thermal_activate_trip_type;
180 + 180 +