Skip to content

Commit 44babd8

Browse files
committed
ACPI: thermal: Move get_active_temp()
Put the get_active_temp() function next to the analogous get_passive_temp() one to allow subsequent changes to be easier to follow. No functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
1 parent 8820087 commit 44babd8

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

drivers/acpi/thermal.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,29 @@ static long get_passive_temp(struct acpi_thermal *tz)
189189
return tmp;
190190
}
191191

192+
static long get_active_temp(struct acpi_thermal *tz, int index)
193+
{
194+
char method[] = { '_', 'A', 'C', '0' + index, '\0' };
195+
unsigned long long tmp;
196+
acpi_status status;
197+
198+
status = acpi_evaluate_integer(tz->device->handle, method, NULL, &tmp);
199+
if (ACPI_FAILURE(status))
200+
return THERMAL_TEMP_INVALID;
201+
202+
/*
203+
* If an override has been provided, apply it so there are no active
204+
* trips with thresholds greater than the override.
205+
*/
206+
if (act > 0) {
207+
unsigned long long override = celsius_to_deci_kelvin(act);
208+
209+
if (tmp > override)
210+
tmp = override;
211+
}
212+
return tmp;
213+
}
214+
192215
static void acpi_thermal_update_passive_trip(struct acpi_thermal *tz)
193216
{
194217
struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip;
@@ -247,29 +270,6 @@ static void acpi_thermal_update_trip_devices(struct acpi_thermal *tz, int index)
247270
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
248271
}
249272

250-
static long get_active_temp(struct acpi_thermal *tz, int index)
251-
{
252-
char method[] = { '_', 'A', 'C', '0' + index, '\0' };
253-
unsigned long long tmp;
254-
acpi_status status;
255-
256-
status = acpi_evaluate_integer(tz->device->handle, method, NULL, &tmp);
257-
if (ACPI_FAILURE(status))
258-
return THERMAL_TEMP_INVALID;
259-
260-
/*
261-
* If an override has been provided, apply it so there are no active
262-
* trips with thresholds greater than the override.
263-
*/
264-
if (act > 0) {
265-
unsigned long long override = celsius_to_deci_kelvin(act);
266-
267-
if (tmp > override)
268-
tmp = override;
269-
}
270-
return tmp;
271-
}
272-
273273
static void acpi_thermal_update_active_trip(struct acpi_thermal *tz, int index)
274274
{
275275
struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;

0 commit comments

Comments
 (0)