| From 39925dc663cf30298bc68aebc2117617b72a54d2 Mon Sep 17 00:00:00 2001 |
| From: Chen-Yu Tsai <wenst@chromium.org> |
| Date: Thu, 30 Mar 2023 16:08:35 +0800 |
| Subject: [PATCH] FIXUP: FROMLIST: thermal: mediatek: add another get_temp ops |
| for thermal sensors |
| |
| The original patch changed the thermal zone device's private data, i.e. |
| tz->devdata, adding one layer of indirection. It seems that during the |
| rebase, the change on the thermal zone registration side was preserved, |
| but on the temperature readout side it was not. This causes the |
| temperature readout to crash, as it tries to dereference a pointer of |
| an incorrect type. |
| |
| Fix this by adding back the change in mtk_read_temp() and |
| mtk_read_sensor_temp(). |
| |
| BUG=b:236331727 |
| TEST=Build and boot on kukui / jacuzzi |
| UPSTREAM-TASK=b:204226007, b:236331727 |
| |
| Change-Id: I95dc0686f7e773a8efbd840c30352fe7895f7037 |
| Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4384325 |
| Reviewed-by: Fei Shao <fshao@chromium.org> |
| --- |
| drivers/thermal/mediatek/auxadc_thermal.c | 6 ++++-- |
| 1 file changed, 4 insertions(+), 2 deletions(-) |
| |
| diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c |
| index f66f1a5e2b38cb4e662ede0929f2faab815bacd9..11e211e3010a314a6204e4a7f655dfe61c09191d 100644 |
| --- a/drivers/thermal/mediatek/auxadc_thermal.c |
| +++ b/drivers/thermal/mediatek/auxadc_thermal.c |
| @@ -1061,7 +1061,8 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) |
| |
| static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature) |
| { |
| - struct mtk_thermal *mt = thermal_zone_device_priv(tz); |
| + struct mtk_thermal_zone *mtz = tz->devdata; |
| + struct mtk_thermal *mt = mtz->mt; |
| int i; |
| int tempmax = INT_MIN; |
| |
| @@ -1082,7 +1083,8 @@ static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature) |
| |
| static int mtk_read_sensor_temp(struct thermal_zone_device *tz, int *temperature) |
| { |
| - struct mtk_thermal *mt = tz->devdata; |
| + struct mtk_thermal_zone *mtz = tz->devdata; |
| + struct mtk_thermal *mt = mtz->mt; |
| const struct mtk_thermal_data *conf = mt->conf; |
| int id = tz->id - 1; |
| int temp = INT_MIN; |
| -- |
| 2.38.3 |
| |