[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230226225406.979703-1-daniel.lezcano@linaro.org>
Date: Sun, 26 Feb 2023 23:53:46 +0100
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: rafael@...nel.org, daniel.lezcano@...aro.org
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
Zhang Rui <rui.zhang@...el.com>, Len Brown <lenb@...nel.org>,
Damien Le Moal <damien.lemoal@...nsource.wdc.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Ido Schimmel <idosch@...dia.com>,
Petr Machata <petrm@...dia.com>,
Gregory Greenman <gregory.greenman@...el.com>,
Kalle Valo <kvalo@...nel.org>,
Sebastian Reichel <sre@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Amit Kucheria <amitk@...nel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
Ray Jui <rjui@...adcom.com>,
Scott Branden <sbranden@...adcom.com>,
Markus Mayer <mmayer@...adcom.com>,
Support Opensource <support.opensource@...semi.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Thara Gopinath <thara.gopinath@...il.com>,
Niklas Söderlund <niklas.soderlund@...natech.se>,
Heiko Stuebner <heiko@...ech.de>,
Bartlomiej Zolnierkiewicz <bzolnier@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
Vasily Khoruzhick <anarsoul@...il.com>,
Yangtao Li <tiny.windzz@...il.com>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Talel Shenhar <talel@...zon.com>,
Eduardo Valentin <edubezval@...il.com>,
Keerthy <j-keerthy@...com>,
Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Stefan Wahren <stefan.wahren@...e.com>,
Zheng Yongjun <zhengyongjun3@...wei.com>,
Yang Li <yang.lee@...ux.alibaba.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Daniel Golle <daniel@...rotopia.org>,
Balsam CHIHI <bchihi@...libre.com>,
Mikko Perttunen <mperttunen@...dia.com>,
linux-acpi@...r.kernel.org, linux-ide@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-hwmon@...r.kernel.org,
linux-iio@...r.kernel.org, linux-sunxi@...ts.linux.dev,
linux-input@...r.kernel.org, netdev@...r.kernel.org,
linux-wireless@...r.kernel.org,
linux-rpi-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-rockchip@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-omap@...r.kernel.org, linux-mediatek@...ts.infradead.org
Subject: [PATCH v3 00/20] 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:
- 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" <rafael@...nel.org>
Cc: Zhang Rui <rui.zhang@...el.com>
Cc: Len Brown <lenb@...nel.org>
Cc: Damien Le Moal <damien.lemoal@...nsource.wdc.com>
Cc: Shawn Guo <shawnguo@...nel.org>
Cc: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Pengutronix Kernel Team <kernel@...gutronix.de>
Cc: Fabio Estevam <festevam@...il.com>
Cc: NXP Linux Team <linux-imx@....com>
Cc: Jean Delvare <jdelvare@...e.com>
Cc: Guenter Roeck <linux@...ck-us.net>
Cc: Jonathan Cameron <jic23@...nel.org>
Cc: Lars-Peter Clausen <lars@...afoo.de>
Cc: Chen-Yu Tsai <wens@...e.org>
Cc: Jernej Skrabec <jernej.skrabec@...il.com>
Cc: Samuel Holland <samuel@...lland.org>
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Eric Dumazet <edumazet@...gle.com>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Paolo Abeni <pabeni@...hat.com>
Cc: Ido Schimmel <idosch@...dia.com>
Cc: Petr Machata <petrm@...dia.com>
Cc: Gregory Greenman <gregory.greenman@...el.com>
Cc: Kalle Valo <kvalo@...nel.org>
Cc: Sebastian Reichel <sre@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>
Cc: Mark Brown <broonie@...nel.org>
Cc: Miquel Raynal <miquel.raynal@...tlin.com>
Cc: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: Amit Kucheria <amitk@...nel.org>
Cc: Florian Fainelli <f.fainelli@...il.com>
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>
Cc: Ray Jui <rjui@...adcom.com>
Cc: Scott Branden <sbranden@...adcom.com>
Cc: Markus Mayer <mmayer@...adcom.com>
Cc: Support Opensource <support.opensource@...semi.com>
Cc: Andy Gross <agross@...nel.org>
Cc: Bjorn Andersson <andersson@...nel.org>
Cc: Konrad Dybcio <konrad.dybcio@...aro.org>
Cc: Thara Gopinath <thara.gopinath@...il.com>
Cc: "Niklas Söderlund" <niklas.soderlund@...natech.se>
Cc: Heiko Stuebner <heiko@...ech.de>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@...il.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Alim Akhtar <alim.akhtar@...sung.com>
Cc: Orson Zhai <orsonzhai@...il.com>
Cc: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: Chunyan Zhang <zhang.lyra@...il.com>
Cc: Vasily Khoruzhick <anarsoul@...il.com>
Cc: Yangtao Li <tiny.windzz@...il.com>
Cc: Thierry Reding <thierry.reding@...il.com>
Cc: Jonathan Hunter <jonathanh@...dia.com>
Cc: Talel Shenhar <talel@...zon.com>
Cc: Eduardo Valentin <edubezval@...il.com>
Cc: Keerthy <j-keerthy@...com>
Cc: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Matthias Brugger <matthias.bgg@...il.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Cc: Stefan Wahren <stefan.wahren@...e.com>
Cc: Zheng Yongjun <zhengyongjun3@...wei.com>
Cc: Yang Li <yang.lee@...ux.alibaba.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc: Daniel Golle <daniel@...rotopia.org>
Cc: Balsam CHIHI <bchihi@...libre.com>
Cc: Mikko Perttunen <mperttunen@...dia.com>
Cc: linux-acpi@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Cc: linux-ide@...r.kernel.org
Cc: linux-arm-kernel@...ts.infradead.org
Cc: linux-hwmon@...r.kernel.org
Cc: linux-iio@...r.kernel.org
Cc: linux-sunxi@...ts.linux.dev
Cc: linux-input@...r.kernel.org
Cc: netdev@...r.kernel.org
Cc: linux-wireless@...r.kernel.org
Cc: linux-pm@...r.kernel.org
Cc: linux-rpi-kernel@...ts.infradead.org
Cc: linux-arm-msm@...r.kernel.org
Cc: linux-renesas-soc@...r.kernel.org
Cc: linux-rockchip@...ts.infradead.org
Cc: linux-samsung-soc@...r.kernel.org
Cc: linux-tegra@...r.kernel.org
Cc: linux-omap@...r.kernel.org
Cc: linux-mediatek@...ts.infradead.org
Daniel Lezcano (20):
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/tegra: Do not enable the thermal zone, it is already enabled
thermal/drivers/acerhdf: Make interval setting only at module load
time
thermal/drivers/acerhdf: Remove pointless governor test
thermal/traces: Replace the thermal zone structure parameter with the
field value
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/gov_fair_share.c | 4 +-
drivers/thermal/gov_power_allocator.c | 6 ++-
drivers/thermal/gov_step_wise.c | 4 +-
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 | 4 +-
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 | 26 +++++++++-
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 ++++++++
include/trace/events/thermal.h | 24 +++++-----
.../trace/events/thermal_power_allocator.h | 12 ++---
72 files changed, 251 insertions(+), 270 deletions(-)
--
2.34.1
Powered by blists - more mailing lists