Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11923C7EE30 for ; Fri, 3 Mar 2023 09:25:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231172AbjCCJZW (ORCPT ); Fri, 3 Mar 2023 04:25:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbjCCJZC (ORCPT ); Fri, 3 Mar 2023 04:25:02 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 324165C12A for ; Fri, 3 Mar 2023 01:24:44 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id l1so1556757wry.12 for ; Fri, 03 Mar 2023 01:24:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677835482; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qZW13a6M4CbKDv+/tbaLjH07R3EIPpeX9wuis9iCl0M=; b=RfgXVuHmkLq5H7QR1aoNvvv2IALanaH0P/POcAYoDGfK0laJjSXiUXMG2kCc40DmBV 5ao/QP6HdIAaN6hNk1zsTzmBzkjlvVSzfFS32NfO47ganlGU74uAoAc1ONN+fKkDAW9x PX+j4q4yKvu2RAejYMPqtDX+48X9mtQ1/g9Vf3iteKlk+hgIhFTUB5g2QFY/UIh+osJ0 fL6DK+KImynrpdP8OB9rryz08dmc6/+BcNgfGSBVfXMAbbsUaNG2kjFjD85Q95edAEuw Uzo33thMuESwFCv9ZVOxFgln7WLK59Zrhky23WQocCu9bvPQsGwITh3daE7wri7PgkXk 2ABg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677835482; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qZW13a6M4CbKDv+/tbaLjH07R3EIPpeX9wuis9iCl0M=; b=xmBBxCNe0OzUhYIWEc/mTQ2JpqZrXnirJqBimXmchbVBGGFaSgEi8ksaLCRU6nfsKP krhJV9+5CvxYz0/gZFtVWk2a/oeLtzas9luLULYMJbv2pMXL/yfQ7xtEeSDSayI7cAoq m3LdvUNCEOk67rfksRis283SjB5qxLwVJN2suCkUsftOksDN8EBqXlvMbqdsEUCLBIvP FoeFbbg2XERjhd5Zu2kTvY30Ul/yoaNgbxrj3j00nluFj3nUqWKM2KYsm3L3P6//ZhNN 4yaeS1JHBc6nDXwnR6NyBgkVzYLf53YORXpRFZBZcLcVK+LrYzftaQe0zHf72iEx7bnA tk9g== X-Gm-Message-State: AO0yUKUAUxwuiheaML++6TRJTr083mBLHgNDHHg7L8DXZCl6X98h4QLl LgXs9gr/luFO5RxhYrSmbXFong== X-Google-Smtp-Source: AK7set/TivsVLpZgfVwr7zBuzY0idsigW/sKtrB0Gs+T0bp+j2ltmNPJktyEla4UqtSRdklCLprlWw== X-Received: by 2002:adf:e60b:0:b0:2ca:9950:718 with SMTP id p11-20020adfe60b000000b002ca99500718mr890693wrm.52.1677835482554; Fri, 03 Mar 2023 01:24:42 -0800 (PST) Received: from ?IPV6:2a05:6e02:1041:c10:e474:bda6:c260:d90b? ([2a05:6e02:1041:c10:e474:bda6:c260:d90b]) by smtp.googlemail.com with ESMTPSA id p7-20020a5d48c7000000b002c71d206329sm1631219wrs.55.2023.03.03.01.24.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Mar 2023 01:24:41 -0800 (PST) Message-ID: <1d3da42e-2499-7ff6-50fa-048a720e855f@linaro.org> Date: Fri, 3 Mar 2023 10:24:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v5 00/18] Self-encapsulate the thermal zone device structure Content-Language: en-US To: rafael@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Rui , Len Brown , Damien Le Moal , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Jean Delvare , Guenter Roeck , Jonathan Cameron , Lars-Peter Clausen , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dmitry Torokhov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ido Schimmel , Petr Machata , Gregory Greenman , Kalle Valo , Sebastian Reichel , Liam Girdwood , Mark Brown , Miquel Raynal , Amit Kucheria , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Markus Mayer , Support Opensource , Andy Gross , Bjorn Andersson , Konrad Dybcio , Thara Gopinath , =?UTF-8?Q?Niklas_S=c3=b6derlund?= , Heiko Stuebner , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Orson Zhai , Baolin Wang , Chunyan Zhang , Vasily Khoruzhick , Yangtao Li , Thierry Reding , Jonathan Hunter , Talel Shenhar , Eduardo Valentin , Keerthy , Kunihiko Hayashi , Masami Hiramatsu , Matthias Brugger , AngeloGioacchino Del Regno , Stefan Wahren , Zheng Yongjun , Yang Li , Srinivas Pandruvada , Daniel Golle , Balsam CHIHI , Mikko Perttunen , linux-acpi@vger.kernel.org, linux-ide@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-input@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-mediatek@lists.infradead.org References: <20230301201446.3713334-1-daniel.lezcano@linaro.org> From: Daniel Lezcano In-Reply-To: <20230301201446.3713334-1-daniel.lezcano@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, Do we have enough ack to apply this series, is it for you ? Thanks -- Daniel On 01/03/2023 21:14, Daniel Lezcano wrote: > 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" > Cc: Zhang Rui > Cc: Len Brown > Cc: Damien Le Moal > Cc: Shawn Guo > Cc: Sascha Hauer > Cc: Pengutronix Kernel Team > Cc: Fabio Estevam > Cc: NXP Linux Team > Cc: Jean Delvare > Cc: Guenter Roeck > Cc: Jonathan Cameron > Cc: Lars-Peter Clausen > Cc: Chen-Yu Tsai > Cc: Jernej Skrabec > Cc: Samuel Holland > Cc: Dmitry Torokhov > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: Ido Schimmel > Cc: Petr Machata > Cc: Gregory Greenman > Cc: Kalle Valo > Cc: Sebastian Reichel > Cc: Liam Girdwood > Cc: Mark Brown > Cc: Miquel Raynal > Cc: Daniel Lezcano > Cc: Amit Kucheria > Cc: Florian Fainelli > Cc: Broadcom internal kernel review list > Cc: Ray Jui > Cc: Scott Branden > Cc: Markus Mayer > Cc: Support Opensource > Cc: Andy Gross > Cc: Bjorn Andersson > Cc: Konrad Dybcio > Cc: Thara Gopinath > Cc: "Niklas Söderlund" > Cc: Heiko Stuebner > Cc: Bartlomiej Zolnierkiewicz > Cc: Krzysztof Kozlowski > Cc: Alim Akhtar > Cc: Orson Zhai > Cc: Baolin Wang > Cc: Chunyan Zhang > Cc: Vasily Khoruzhick > Cc: Yangtao Li > Cc: Thierry Reding > Cc: Jonathan Hunter > Cc: Talel Shenhar > Cc: Eduardo Valentin > Cc: Keerthy > Cc: Kunihiko Hayashi > Cc: Masami Hiramatsu > Cc: Matthias Brugger > Cc: AngeloGioacchino Del Regno > Cc: Stefan Wahren > Cc: Zheng Yongjun > Cc: Yang Li > Cc: Srinivas Pandruvada > Cc: Daniel Golle > Cc: Balsam CHIHI > Cc: Mikko Perttunen > Cc: linux-acpi@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: linux-ide@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-hwmon@vger.kernel.org > Cc: linux-iio@vger.kernel.org > Cc: linux-sunxi@lists.linux.dev > Cc: linux-input@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: linux-wireless@vger.kernel.org > Cc: linux-pm@vger.kernel.org > Cc: linux-rpi-kernel@lists.infradead.org > Cc: linux-arm-msm@vger.kernel.org > Cc: linux-renesas-soc@vger.kernel.org > Cc: linux-rockchip@lists.infradead.org > Cc: linux-samsung-soc@vger.kernel.org > Cc: linux-tegra@vger.kernel.org > Cc: linux-omap@vger.kernel.org > Cc: linux-mediatek@lists.infradead.org > > 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(-) > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog