Skip to content

Self-encapsulate the thermal zone device structure

Daniel Lezcano linux-acpi linux-amlogic linux-arm-kernel linux-arm-msm linux-hwmon linux-ide linux-iio linux-input linux-mediatek linux-omap linux-pm linux-renesas-soc linux-rockchip linux-samsung-soc linux-sunxi linux-tegra linux-wireless lkml netdev platform-driver-x86 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest18 patches 10 repliesIn review
  2. v419 patches 7 repliesSuperseded
  3. v3 posting 3/320 patches 7 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v3 posting 2/30 of 17 patches0 repliesSuperseded
v3 posting 1/30 of 17 patches1 replySuperseded
v2 posting 2/216 patches24 repliesSuperseded
v2 posting 1/20 of 17 patches0 repliesSuperseded
v117 patches28 repliesSuperseded

Changelog from the cover letter · 21 lines

- V5:
- Dropped patch 19 : "thermal/tegra: Do not enable ... is already enabled"
- Changed the init sequence of the hw channels on tegra3 to close the race window
- Collected more tags
- V4:
- Collected more tags
- Fixed a typo therma_zone_device_priv() for db8500
- Remove traces patch [20/20] to be submitted separetely
- V3:
- Split the first patch into three to reduce the number of recipients per change
- Collected more tags
- Added missing changes for ->devdata in some drivers
- Added a 'type' accessor
- Replaced the 'type' to 'id' changes by the 'type' accessor
- Used the 'type' accessor in the drivers
- V2:
- Collected tags
- Added missing changes for ->devdata for the tsens driver
- Renamed thermal_zone_device_get_data() to thermal_zone_priv()
- Added stubs when CONFIG_THERMAL is not set
- Dropped hwmon change where we remove the tz->lock usage

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18thermal/core: Add a thermal zone 'devdata' accessordrivers/thermal/thermal_core.c include/linux/thermal.h+13 -00 replies
2/18thermal/core: Use the thermal zone 'devdata' accessor in thermal located driversdrivers/thermal/amlogic_thermal.c drivers/thermal/armada_thermal.c drivers/thermal/broadcom/bcm2711_thermal.c +45 more+79 -814 replies
3/18thermal/core: Use the thermal zone 'devdata' accessor in hwmon located driversdrivers/hwmon/hwmon.c drivers/hwmon/pmbus/pmbus_core.c drivers/hwmon/scmi-hwmon.c +1 more+5 -50 replies
4/18thermal/core: Use the thermal zone 'devdata' accessor in remaining driversdrivers/acpi/thermal.c drivers/ata/ahci_imx.c drivers/iio/adc/sun4i-gpadc-iio.c +6 more+23 -230 replies
5/18thermal/core: Show a debug message when get_temp() failsdrivers/thermal/thermal_helpers.c+3 -00 replies
6/18thermal: Remove debug or error messages in get_temp() opsdrivers/thermal/armada_thermal.c drivers/thermal/broadcom/brcmstb_thermal.c drivers/thermal/dove_thermal.c +8 more+10 -411 reply
7/18thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs()drivers/thermal/broadcom/bcm2711_thermal.c drivers/thermal/broadcom/bcm2835_thermal.c drivers/thermal/rcar_gen3_thermal.c +3 more+0 -101 reply
8/18thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs()drivers/thermal/amlogic_thermal.c drivers/thermal/imx8mm_thermal.c drivers/thermal/imx_sc_thermal.c +11 more+16 -160 replies
9/18thermal: Don't use 'device' internal thermal zone structure fielddrivers/thermal/imx_thermal.c drivers/thermal/mediatek/lvts_thermal.c drivers/thermal/thermal_hwmon.c +1 more+13 -340 replies
10/18thermal/core: Add thermal_zone_device structure 'type' accessordrivers/thermal/thermal_core.c include/linux/thermal.h+12 -00 replies
11/18thermal/drivers/spear: Don't use tz->device but pdev->devdrivers/thermal/spear_thermal.c+1 -10 replies
12/18thermal: Add a thermal zone id accessordrivers/acpi/thermal.c drivers/hwmon/scmi-hwmon.c drivers/thermal/thermal_core.c +1 more+14 -20 replies
13/18thermal: Use thermal_zone_device_type() accessordrivers/net/ethernet/mellanox/mlxsw/core_thermal.c drivers/thermal/mediatek/lvts_thermal.c drivers/thermal/ti-soc-thermal/ti-thermal-common.c+6 -40 replies
14/18thermal/drivers/da9062: Don't access the thermal zone device fieldsdrivers/thermal/da9062-thermal.c+7 -40 replies
15/18thermal/hwmon: Use the thermal_core.h headerdrivers/thermal/thermal_hwmon.c+1 -00 replies
16/18thermal/drivers/tegra: Remove unneeded lock when setting a trip pointdrivers/thermal/tegra/tegra30-tsensor.c+14 -112 replies
17/18thermal/drivers/acerhdf: Make interval setting only at module load timedrivers/platform/x86/acerhdf.c+3 -90 replies
18/18thermal/drivers/acerhdf: Remove pointless governor testdrivers/platform/x86/acerhdf.c+0 -70 replies

Reviews trailers per patch

16 of 18 patches have a Reviewed-by or Acked-by.

PatchNiklas SöderlundMark BrownAngeloGioacchino Del RegnoBalsam CHIHIAdam WardBaolin WangJernej SkrabecRafael J. WysockiFlorian FainelliDhruva GoleIdo SchimmelGregory GreenmanSebastian ReichelDamien Le MoalMartin BlumenstinglGuenter RoeckMiquel RaynalJean DelvarePeter KaestleHans de GoedeThierry RedingLinus WalleijHeiko StuebnerKunihiko Hayashi
1/18A-b A-b
2/18R-b A-b R-b R-b R-b R-b A-b A-b A-b R-b A-b A-b R-b
3/18A-b A-b A-b
4/18A-b A-b R-b A-b A-b A-b
5/18A-b
6/18A-b R-b A-b
7/18R-b A-b A-b
8/18R-b A-b A-b
9/18R-b R-b
10/18
11/18
12/18A-b A-b
13/18R-b R-b
14/18R-b
15/18A-b R-b
16/18A-b
17/18A-b R-b
18/18A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 24 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/18] Self-encapsulate the thermal zone device structure

The exported thermal headers expose the thermal core structure while those should be private to the framework. The initial idea was the thermal sensor drivers use the thermal zone device structure pointer to pass it around from the ops to the thermal framework API like a handler.

Unfortunately, different drivers are using and abusing the internals of this structure to hook the associated struct device, read the internals values, take the lock, etc ...

In order to fix this situation, let's encapsulate the structure leaking the more in the different drivers: the thermal_zone_device structure.

This series revisit the existing drivers using the thermal zone private structure internals to change the access to something else. For instance, the get_temp() ops is using the tz->dev to write a debug trace. Despite the trace is not helpful, we can check the return value for the get_temp() ops in the call site and show the message in this place.

With this set of changes, the thermal_zone_device is almost self-encapsulated. As usual, the acpi driver needs a more complex changes, so that will come in a separate series along with the structure moved the private core headers.

Changelog:
- V5:
- Dropped patch 19 : "thermal/tegra: Do not enable ... is already enabled"
- Changed the init sequence of the hw channels on tegra3 to close the race window
- Collected more tags
- V4:
- Collected more tags
- Fixed a typo therma_zone_device_priv() for db8500
- Remove traces patch [20/20] to be submitted separetely
- V3:
- Split the first patch into three to reduce the number of recipients per change
- Collected more tags
- Added missing changes for ->devdata in some drivers
- Added a 'type' accessor
- Replaced the 'type' to 'id' changes by the 'type' accessor
- Used the 'type' accessor in the drivers
- V2:
- Collected tags
- Added missing changes for ->devdata for the tsens driver
- Renamed thermal_zone_device_get_data() to thermal_zone_priv()
- Added stubs when CONFIG_THERMAL is not set
- Dropped hwmon change where we remove the tz->lock usage

Thank you all for your comments

Cc "Rafael J. Wysocki" <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Len Brown <[email protected]>
Cc Damien Le Moal <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Pengutronix Kernel Team <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc NXP Linux Team <[email protected]>
Cc Jean Delvare <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Jernej Skrabec <[email protected]>
Cc Samuel Holland <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Petr Machata <[email protected]>
Cc Gregory Greenman <[email protected]>
Cc Kalle Valo <[email protected]>
Cc Sebastian Reichel <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
Cc Miquel Raynal <[email protected]>
Cc Daniel Lezcano <[email protected]>
Cc Amit Kucheria <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Broadcom internal kernel review list <[email protected]>
Cc Ray Jui <[email protected]>
Cc Scott Branden <[email protected]>
Cc Markus Mayer <[email protected]>
Cc Support Opensource <[email protected]>
Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Konrad Dybcio <[email protected]>
Cc Thara Gopinath <[email protected]>
Cc "Niklas Söderlund" <[email protected]>
Cc Heiko Stuebner <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Alim Akhtar <[email protected]>
Cc Orson Zhai <[email protected]>
Cc Baolin Wang <[email protected]>
Cc Chunyan Zhang <[email protected]>
Cc Vasily Khoruzhick <[email protected]>
Cc Yangtao Li <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Jonathan Hunter <[email protected]>
Cc Talel Shenhar <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Keerthy <[email protected]>
Cc Kunihiko Hayashi <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Matthias Brugger <[email protected]>
Cc AngeloGioacchino Del Regno <[email protected]>
Cc Stefan Wahren <[email protected]>
Cc Zheng Yongjun <[email protected]>
Cc Yang Li <[email protected]>
Cc Srinivas Pandruvada <[email protected]>
Cc Daniel Golle <[email protected]>
Cc Balsam CHIHI <[email protected]>
Cc Mikko Perttunen <[email protected]>

Daniel Lezcano (18):
thermal/core: Add a thermal zone 'devdata' accessor thermal/core: Use the thermal zone 'devdata' accessor in thermal
located drivers
thermal/core: Use the thermal zone 'devdata' accessor in hwmon located
drivers
thermal/core: Use the thermal zone 'devdata' accessor in remaining
drivers
thermal/core: Show a debug message when get_temp() fails
thermal: Remove debug or error messages in get_temp() ops thermal/hwmon: Do not set no_hwmon before calling
thermal_add_hwmon_sysfs()
thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs()
thermal: Don't use 'device' internal thermal zone structure field thermal/core: Add thermal_zone_device structure 'type' accessor thermal/drivers/spear: Don't use tz->device but pdev->dev
thermal: Add a thermal zone id accessor
thermal: Use thermal_zone_device_type() accessor thermal/drivers/da9062: Don't access the thermal zone device fields thermal/hwmon: Use the thermal_core.h header thermal/drivers/tegra: Remove unneeded lock when setting a trip point thermal/drivers/acerhdf: Make interval setting only at module load
time
thermal/drivers/acerhdf: Remove pointless governor test

 drivers/acpi/thermal.c                        | 18 +++----
 drivers/ata/ahci_imx.c                        |  2 +-
 drivers/hwmon/hwmon.c                         |  4 +-
 drivers/hwmon/pmbus/pmbus_core.c              |  2 +-
 drivers/hwmon/scmi-hwmon.c                    |  4 +-
 drivers/hwmon/scpi-hwmon.c                    |  2 +-
 drivers/iio/adc/sun4i-gpadc-iio.c             |  2 +-
 drivers/input/touchscreen/sun4i-ts.c          |  2 +-
 .../ethernet/chelsio/cxgb4/cxgb4_thermal.c    |  2 +-
 .../ethernet/mellanox/mlxsw/core_thermal.c    | 16 +++----
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c   |  4 +-
 drivers/platform/x86/acerhdf.c                | 19 ++------
 drivers/power/supply/power_supply_core.c      |  2 +-
 drivers/regulator/max8973-regulator.c         |  2 +-
 drivers/thermal/amlogic_thermal.c             |  4 +-
 drivers/thermal/armada_thermal.c              | 14 ++----
 drivers/thermal/broadcom/bcm2711_thermal.c    |  3 +-
 drivers/thermal/broadcom/bcm2835_thermal.c    |  3 +-
 drivers/thermal/broadcom/brcmstb_thermal.c    |  8 ++--
 drivers/thermal/broadcom/ns-thermal.c         |  2 +-
 drivers/thermal/broadcom/sr-thermal.c         |  2 +-
 drivers/thermal/da9062-thermal.c              | 13 +++--
 drivers/thermal/db8500_thermal.c              |  2 +-
 drivers/thermal/dove_thermal.c                |  7 +--
 drivers/thermal/hisi_thermal.c                |  5 +-
 drivers/thermal/imx8mm_thermal.c              |  4 +-
 drivers/thermal/imx_sc_thermal.c              |  9 ++--
 drivers/thermal/imx_thermal.c                 | 47 +++++--------------
 .../intel/int340x_thermal/int3400_thermal.c   |  2 +-
 .../int340x_thermal/int340x_thermal_zone.c    |  4 +-
 .../processor_thermal_device_pci.c            |  4 +-
 drivers/thermal/intel/intel_pch_thermal.c     |  2 +-
 .../thermal/intel/intel_quark_dts_thermal.c   |  6 +--
 drivers/thermal/intel/intel_soc_dts_iosf.c    | 13 ++---
 drivers/thermal/intel/x86_pkg_temp_thermal.c  |  4 +-
 drivers/thermal/k3_bandgap.c                  |  4 +-
 drivers/thermal/k3_j72xx_bandgap.c            |  2 +-
 drivers/thermal/kirkwood_thermal.c            |  7 +--
 drivers/thermal/max77620_thermal.c            |  6 +--
 drivers/thermal/mediatek/auxadc_thermal.c     |  4 +-
 drivers/thermal/mediatek/lvts_thermal.c       | 10 ++--
 drivers/thermal/qcom/qcom-spmi-adc-tm5.c      |  6 +--
 drivers/thermal/qcom/qcom-spmi-temp-alarm.c   |  6 +--
 drivers/thermal/qcom/tsens.c                  |  6 +--
 drivers/thermal/qoriq_thermal.c               |  4 +-
 drivers/thermal/rcar_gen3_thermal.c           |  5 +-
 drivers/thermal/rcar_thermal.c                |  8 +---
 drivers/thermal/rockchip_thermal.c            |  8 +---
 drivers/thermal/rzg2l_thermal.c               |  3 +-
 drivers/thermal/samsung/exynos_tmu.c          |  4 +-
 drivers/thermal/spear_thermal.c               | 10 ++--
 drivers/thermal/sprd_thermal.c                |  2 +-
 drivers/thermal/st/st_thermal.c               |  5 +-
 drivers/thermal/st/stm_thermal.c              |  4 +-
 drivers/thermal/sun8i_thermal.c               |  4 +-
 drivers/thermal/tegra/soctherm.c              |  6 +--
 drivers/thermal/tegra/tegra-bpmp-thermal.c    |  6 ++-
 drivers/thermal/tegra/tegra30-tsensor.c       | 31 ++++++------
 drivers/thermal/thermal-generic-adc.c         |  7 ++-
 drivers/thermal/thermal_core.c                | 18 +++++++
 drivers/thermal/thermal_helpers.c             |  3 ++
 drivers/thermal/thermal_hwmon.c               |  9 ++--
 drivers/thermal/thermal_hwmon.h               |  4 +-
 drivers/thermal/thermal_mmio.c                |  2 +-
 .../ti-soc-thermal/ti-thermal-common.c        | 10 ++--
 drivers/thermal/uniphier_thermal.c            |  2 +-
 include/linux/thermal.h                       | 19 ++++++++
 67 files changed, 218 insertions(+), 246 deletions(-)
Signature · 1 line
2.34.1