From 5a3506657f71d7ca124c040aff98639673c5dc97 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Mon, 29 Jun 2020 14:29:18 +0200 Subject: thermal: Store device mode in struct thermal_zone_device Prepare for eliminating get_mode(). Signed-off-by: Andrzej Pietrasiewicz [for acerhdf] Acked-by: Peter Kaestle Reviewed-by: Bartlomiej Zolnierkiewicz Reviewed-by: Amit Kucheria Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200629122925.21729-5-andrzej.p@collabora.com --- drivers/acpi/thermal.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index fb46070c66d8..4ba273f49d87 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -172,7 +172,6 @@ struct acpi_thermal { struct acpi_thermal_trips trips; struct acpi_handle_list devices; struct thermal_zone_device *thermal_zone; - enum thermal_device_mode mode; int kelvin_offset; /* in millidegrees */ struct work_struct thermal_check_work; }; @@ -500,7 +499,7 @@ static void acpi_thermal_check(void *data) { struct acpi_thermal *tz = data; - if (tz->mode != THERMAL_DEVICE_ENABLED) + if (tz->thermal_zone->mode != THERMAL_DEVICE_ENABLED) return; thermal_zone_device_update(tz->thermal_zone, @@ -529,12 +528,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) static int thermal_get_mode(struct thermal_zone_device *thermal, enum thermal_device_mode *mode) { - struct acpi_thermal *tz = thermal->devdata; - - if (!tz) - return -EINVAL; - - *mode = tz->mode; + *mode = thermal->mode; return 0; } @@ -556,11 +550,11 @@ static int thermal_set_mode(struct thermal_zone_device *thermal, if (mode == THERMAL_DEVICE_DISABLED) pr_warn("thermal zone will be disabled\n"); - if (mode != tz->mode) { - tz->mode = mode; + if (mode != tz->thermal_zone->mode) { + tz->thermal_zone->mode = mode; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s kernel ACPI thermal control\n", - tz->mode == THERMAL_DEVICE_ENABLED ? + tz->thermal_zone->mode == THERMAL_DEVICE_ENABLED ? "Enable" : "Disable")); acpi_thermal_check(tz); } @@ -912,7 +906,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) goto remove_dev_link; } - tz->mode = THERMAL_DEVICE_ENABLED; + tz->thermal_zone->mode = THERMAL_DEVICE_ENABLED; dev_info(&tz->device->dev, "registered as thermal_zone%d\n", tz->thermal_zone->id); -- cgit v1.2.3