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/thermal/intel/int340x_thermal/int3400_thermal.c | 12 +++--------- drivers/thermal/intel/intel_quark_dts_thermal.c | 16 +++++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) (limited to 'drivers/thermal/intel') diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index e84faaadff87..f65b2fc09198 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -48,7 +48,6 @@ struct int3400_thermal_priv { struct acpi_device *adev; struct platform_device *pdev; struct thermal_zone_device *thermal; - enum thermal_device_mode mode; int art_count; struct art *arts; int trt_count; @@ -381,12 +380,7 @@ static int int3400_thermal_get_temp(struct thermal_zone_device *thermal, static int int3400_thermal_get_mode(struct thermal_zone_device *thermal, enum thermal_device_mode *mode) { - struct int3400_thermal_priv *priv = thermal->devdata; - - if (!priv) - return -EINVAL; - - *mode = priv->mode; + *mode = thermal->mode; return 0; } @@ -404,8 +398,8 @@ static int int3400_thermal_set_mode(struct thermal_zone_device *thermal, mode != THERMAL_DEVICE_DISABLED) return -EINVAL; - if (mode != priv->mode) { - priv->mode = mode; + if (mode != thermal->mode) { + thermal->mode = mode; result = int3400_thermal_run_osc(priv->adev->handle, priv->current_uuid_index, mode == THERMAL_DEVICE_ENABLED); diff --git a/drivers/thermal/intel/intel_quark_dts_thermal.c b/drivers/thermal/intel/intel_quark_dts_thermal.c index d704fc104cfd..d77cb3df5ade 100644 --- a/drivers/thermal/intel/intel_quark_dts_thermal.c +++ b/drivers/thermal/intel/intel_quark_dts_thermal.c @@ -103,7 +103,6 @@ struct soc_sensor_entry { bool locked; u32 store_ptps; u32 store_dts_enable; - enum thermal_device_mode mode; struct thermal_zone_device *tzone; }; @@ -128,7 +127,7 @@ static int soc_dts_enable(struct thermal_zone_device *tzd) return ret; if (out & QRK_DTS_ENABLE_BIT) { - aux_entry->mode = THERMAL_DEVICE_ENABLED; + tzd->mode = THERMAL_DEVICE_ENABLED; return 0; } @@ -139,9 +138,9 @@ static int soc_dts_enable(struct thermal_zone_device *tzd) if (ret) return ret; - aux_entry->mode = THERMAL_DEVICE_ENABLED; + tzd->mode = THERMAL_DEVICE_ENABLED; } else { - aux_entry->mode = THERMAL_DEVICE_DISABLED; + tzd->mode = THERMAL_DEVICE_DISABLED; pr_info("DTS is locked. Cannot enable DTS\n"); ret = -EPERM; } @@ -161,7 +160,7 @@ static int soc_dts_disable(struct thermal_zone_device *tzd) return ret; if (!(out & QRK_DTS_ENABLE_BIT)) { - aux_entry->mode = THERMAL_DEVICE_DISABLED; + tzd->mode = THERMAL_DEVICE_DISABLED; return 0; } @@ -173,9 +172,9 @@ static int soc_dts_disable(struct thermal_zone_device *tzd) if (ret) return ret; - aux_entry->mode = THERMAL_DEVICE_DISABLED; + tzd->mode = THERMAL_DEVICE_DISABLED; } else { - aux_entry->mode = THERMAL_DEVICE_ENABLED; + tzd->mode = THERMAL_DEVICE_ENABLED; pr_info("DTS is locked. Cannot disable DTS\n"); ret = -EPERM; } @@ -312,8 +311,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, static int sys_get_mode(struct thermal_zone_device *tzd, enum thermal_device_mode *mode) { - struct soc_sensor_entry *aux_entry = tzd->devdata; - *mode = aux_entry->mode; + *mode = tzd->mode; return 0; } -- cgit v1.2.3