830-v6.4-11-thermal-core-Use-the-thermal-zone-devdata-accessor-i.patch 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. From 7d78bab533eb9aa0e5240e25a204e8f416723ed6 Mon Sep 17 00:00:00 2001
  2. From: Daniel Lezcano <[email protected]>
  3. Date: Wed, 1 Mar 2023 21:14:30 +0100
  4. Subject: [PATCH 07/42] thermal/core: Use the thermal zone 'devdata' accessor
  5. in thermal located drivers
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. The thermal zone device structure is exposed to the different drivers
  10. and obviously they access the internals while that should be
  11. restricted to the core thermal code.
  12. In order to self-encapsulate the thermal core code, we need to prevent
  13. the drivers accessing directly the thermal zone structure and provide
  14. accessor functions to deal with.
  15. Use the devdata accessor introduced in the previous patch.
  16. No functional changes intended.
  17. [skipped drivers not relevant for mediatek target]
  18. Signed-off-by: Daniel Lezcano <[email protected]>
  19. Reviewed-by: Niklas Söderlund <[email protected]> #R-Car
  20. Acked-by: Mark Brown <[email protected]>
  21. Reviewed-by: AngeloGioacchino Del Regno <[email protected]> #MediaTek auxadc and lvts
  22. Reviewed-by: Balsam CHIHI <[email protected]> #Mediatek lvts
  23. Reviewed-by: Adam Ward <[email protected]> #da9062
  24. Reviewed-by: Baolin Wang <[email protected]> #spread
  25. Acked-by: Jernej Skrabec <[email protected]> #sun8i_thermal
  26. Acked-by: Rafael J. Wysocki <[email protected]>
  27. Acked-by: Florian Fainelli <[email protected]> #Broadcom
  28. Reviewed-by: Dhruva Gole <[email protected]> # K3 bandgap
  29. Acked-by: Linus Walleij <[email protected]>
  30. Acked-by: Heiko Stuebner <[email protected]> #rockchip
  31. Reviewed-by: Kunihiko Hayashi <[email protected]> #uniphier
  32. Signed-off-by: Rafael J. Wysocki <[email protected]>
  33. ---
  34. drivers/thermal/mediatek/auxadc_thermal.c | 2 +-
  35. drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
  36. 43 files changed, 71 insertions(+), 73 deletions(-)
  37. --- a/drivers/thermal/mediatek/auxadc_thermal.c
  38. +++ b/drivers/thermal/mediatek/auxadc_thermal.c
  39. @@ -763,7 +763,7 @@ static int mtk_thermal_bank_temperature(
  40. static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature)
  41. {
  42. - struct mtk_thermal *mt = tz->devdata;
  43. + struct mtk_thermal *mt = thermal_zone_device_priv(tz);
  44. int i;
  45. int tempmax = INT_MIN;
  46. --- a/drivers/thermal/mediatek/lvts_thermal.c
  47. +++ b/drivers/thermal/mediatek/lvts_thermal.c
  48. @@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperat
  49. static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
  50. {
  51. - struct lvts_sensor *lvts_sensor = tz->devdata;
  52. + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
  53. void __iomem *msr = lvts_sensor->msr;
  54. u32 value;
  55. @@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_
  56. static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
  57. {
  58. - struct lvts_sensor *lvts_sensor = tz->devdata;
  59. + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
  60. void __iomem *base = lvts_sensor->base;
  61. u32 raw_low = lvts_temp_to_raw(low);
  62. u32 raw_high = lvts_temp_to_raw(high);