summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@collabora.com>2020-06-29 14:29:18 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2020-06-29 20:26:34 +0200
commit5a3506657f71d7ca124c040aff98639673c5dc97 (patch)
tree7cae0f77b9bb04ff0281c62b85b1506e467a572f /drivers/acpi
parentcbba1d719534b77b857267890b0f54f0f0a90de4 (diff)
thermal: Store device mode in struct thermal_zone_device
Prepare for eliminating get_mode(). Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> [for acerhdf] Acked-by: Peter Kaestle <peter@piie.net> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200629122925.21729-5-andrzej.p@collabora.com
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/thermal.c18
1 files changed, 6 insertions, 12 deletions
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);