From nobody Thu Nov 14 06:32:35 2024 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 29546C74A4B for ; Sun, 19 Feb 2023 14:39:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230266AbjBSOij (ORCPT ); Sun, 19 Feb 2023 09:38:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbjBSOh6 (ORCPT ); Sun, 19 Feb 2023 09:37:58 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3806A1204F for ; Sun, 19 Feb 2023 06:37:46 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id f12so575418wrr.4 for ; Sun, 19 Feb 2023 06:37:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+N523DtRIKKcMxEOWF7Xp597YFQu0I7H1QHTM+dJ87Y=; b=zoI4AczXwtkNEOIFMl2oWk0sfwHGUIOKbwJ7fxs9HBT1kYlKyNxDAVtcxnuPL7HZAp aeGd45T+A5eSgm/YMeoBgVNkP/wyvF9ZnW8/u4iMMy6TQWfbcvndVU5soyXr6OBCSR46 RZ59G74q82Ff/AaCnR3f28ZJMUZADKCyiR3FLYK+1RY6lqIDFyLs4YFEpGT5r3jRIjPQ Wf89lMkC148L6syx+bYrRScekQtrRo1JmsHppFSFNlTP5QMqmTm1o7LgLiK2uKzITeBZ OLe0+7/K2iWX2jNPx699wzunQnWJEAe0t4c6IJXueluq1Ft3ispSCeM+QdbXLgIW5mAf 9J1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+N523DtRIKKcMxEOWF7Xp597YFQu0I7H1QHTM+dJ87Y=; b=TH7FUtUN7t+wUPCpE0xyzwDka3NEkUMKWpm+YbTrH2yXxcCLUBfvz977NcE7qKsx3w qqK5cgzLDS1BJOZRcMHfg5aTgDBICimgM8pE9dndKrd18hxQlLjxkDZqvFP++/xH7KNw HlFmGfMaYoKu/lAL8ZFVfKqkaw0sCT6VcJfqb6Py+rKlZivSL0I5aoiiQ+JsL9AttG3j C+caxZNxFJwoAuqQvi6X5IYgIlnoG/pZLawpocKWcYh/u6/K0jz562dYCD2Z/m6nBfw2 Q4w/ipNQRsUfe9UotXZ6yGUELfiKwQKqrfuHqGCQb7mNtiGJpWG2qEi5Irys+PWLTZ9R vroQ== X-Gm-Message-State: AO0yUKW1tKMvt3sRvJFCA9+cXZ0zz9SvpZxlN5MhS37DECOST+35GvQ+ rDaFzxrKrXdZqSC+HKUaXqxCUA== X-Google-Smtp-Source: AK7set8/ARAo2mVqPni3Z48Cd9X8pVAhnwoeFMwIQIpYB8CWtiLwCY9ebYk8SLCeLLePa3xixPYaxw== X-Received: by 2002:adf:ea43:0:b0:2c5:6180:516e with SMTP id j3-20020adfea43000000b002c56180516emr147449wrn.39.1676817463812; Sun, 19 Feb 2023 06:37:43 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.37.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:37:43 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.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 , Raju Rangoju , "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=20S=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 , Neil Armstrong , ye xingchen , Zheng Yongjun , Tim Zimmermann , Yang Li , Srinivas Pandruvada , Ricardo Neri , Jiang Jian , Daniel Golle , Balsam CHIHI , Randy Dunlap , Mikko Perttunen , linux-acpi@vger.kernel.org (open list:ACPI THERMAL DRIVER), linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE), linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING), linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE, JOYSTICK , TOUCHSCREEN)...), netdev@vger.kernel.org (open list:CXGB4 ETHERNET DRIVER (CXGB4)), linux-wireless@vger.kernel.org (open list:INTEL WIRELESS WIFI LINK (iwlwifi)), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT), linux-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR THERMAL DRIVERS), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support), linux-samsung-soc@vger.kernel.org (open list:SAMSUNG THERMAL DRIVER), linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor Date: Sun, 19 Feb 2023 15:36:41 +0100 Message-Id: <20230219143657.241542-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal zone device structure is exposed to the different drivers and obviously they access the internals while that should be restricted to the core thermal code. In order to self-encapsulate the thermal core code, we need to prevent the drivers accessing directly the thermal zone structure and provide accessor functions to deal with. Provide an accessor to the 'devdata' structure and make use of it in the different drivers. No functional changes intended. Signed-off-by: Daniel Lezcano Acked-by: Gregory Greenman Acked-by: Guenter Roeck Acked-by: Mark Brown Acked-by: Sebastian Reichel Reviewed-by: Adam Ward Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Balsam CHIHI Reviewed-by: Baolin Wang Reviewed-by: Ido Schimmel Reviewed-by: Niklas S=C3=B6derlund --- drivers/acpi/thermal.c | 16 ++++++++-------- drivers/ata/ahci_imx.c | 2 +- drivers/hwmon/hwmon.c | 4 ++-- drivers/hwmon/pmbus/pmbus_core.c | 2 +- drivers/hwmon/scmi-hwmon.c | 2 +- drivers/hwmon/scpi-hwmon.c | 2 +- drivers/iio/adc/sun4i-gpadc-iio.c | 2 +- drivers/input/touchscreen/sun4i-ts.c | 2 +- .../net/ethernet/chelsio/cxgb4/cxgb4_thermal.c | 2 +- .../net/ethernet/mellanox/mlxsw/core_thermal.c | 14 +++++++------- drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 4 ++-- drivers/power/supply/power_supply_core.c | 2 +- drivers/regulator/max8973-regulator.c | 2 +- drivers/thermal/armada_thermal.c | 4 ++-- drivers/thermal/broadcom/bcm2711_thermal.c | 2 +- drivers/thermal/broadcom/bcm2835_thermal.c | 2 +- drivers/thermal/broadcom/brcmstb_thermal.c | 4 ++-- drivers/thermal/broadcom/ns-thermal.c | 2 +- drivers/thermal/broadcom/sr-thermal.c | 2 +- drivers/thermal/da9062-thermal.c | 2 +- drivers/thermal/dove_thermal.c | 2 +- drivers/thermal/hisi_thermal.c | 2 +- drivers/thermal/imx8mm_thermal.c | 2 +- drivers/thermal/imx_sc_thermal.c | 2 +- drivers/thermal/imx_thermal.c | 6 +++--- drivers/thermal/intel/intel_pch_thermal.c | 2 +- drivers/thermal/intel/intel_soc_dts_iosf.c | 13 +++++-------- drivers/thermal/intel/x86_pkg_temp_thermal.c | 4 ++-- drivers/thermal/k3_bandgap.c | 2 +- drivers/thermal/k3_j72xx_bandgap.c | 2 +- drivers/thermal/kirkwood_thermal.c | 2 +- drivers/thermal/max77620_thermal.c | 2 +- drivers/thermal/mediatek/auxadc_thermal.c | 2 +- drivers/thermal/mediatek/lvts_thermal.c | 4 ++-- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 4 ++-- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 4 ++-- drivers/thermal/qoriq_thermal.c | 2 +- drivers/thermal/rcar_gen3_thermal.c | 4 ++-- drivers/thermal/rcar_thermal.c | 3 +-- drivers/thermal/rockchip_thermal.c | 4 ++-- drivers/thermal/rzg2l_thermal.c | 2 +- drivers/thermal/samsung/exynos_tmu.c | 4 ++-- drivers/thermal/spear_thermal.c | 8 ++++---- drivers/thermal/sprd_thermal.c | 2 +- drivers/thermal/sun8i_thermal.c | 2 +- drivers/thermal/tegra/tegra-bpmp-thermal.c | 6 ++++-- drivers/thermal/tegra/tegra30-tsensor.c | 4 ++-- drivers/thermal/thermal-generic-adc.c | 2 +- drivers/thermal/thermal_core.c | 6 ++++++ drivers/thermal/thermal_mmio.c | 2 +- .../thermal/ti-soc-thermal/ti-thermal-common.c | 4 ++-- drivers/thermal/uniphier_thermal.c | 2 +- include/linux/thermal.h | 2 ++ 53 files changed, 97 insertions(+), 91 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 0b4b844f9d4c..69d0da6456d5 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -498,7 +498,7 @@ static int acpi_thermal_get_trip_points(struct acpi_the= rmal *tz) =20 static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) { - struct acpi_thermal *tz =3D thermal->devdata; + struct acpi_thermal *tz =3D thermal_zone_device_get_data(thermal); int result; =20 if (!tz) @@ -516,7 +516,7 @@ static int thermal_get_temp(struct thermal_zone_device = *thermal, int *temp) static int thermal_get_trip_type(struct thermal_zone_device *thermal, int trip, enum thermal_trip_type *type) { - struct acpi_thermal *tz =3D thermal->devdata; + struct acpi_thermal *tz =3D thermal_zone_device_get_data(thermal); int i; =20 if (!tz || trip < 0) @@ -560,7 +560,7 @@ static int thermal_get_trip_type(struct thermal_zone_de= vice *thermal, static int thermal_get_trip_temp(struct thermal_zone_device *thermal, int trip, int *temp) { - struct acpi_thermal *tz =3D thermal->devdata; + struct acpi_thermal *tz =3D thermal_zone_device_get_data(thermal); int i; =20 if (!tz || trip < 0) @@ -613,7 +613,7 @@ static int thermal_get_trip_temp(struct thermal_zone_de= vice *thermal, static int thermal_get_crit_temp(struct thermal_zone_device *thermal, int *temperature) { - struct acpi_thermal *tz =3D thermal->devdata; + struct acpi_thermal *tz =3D thermal_zone_device_get_data(thermal); =20 if (tz->trips.critical.flags.valid) { *temperature =3D deci_kelvin_to_millicelsius_with_offset( @@ -628,7 +628,7 @@ static int thermal_get_crit_temp(struct thermal_zone_de= vice *thermal, static int thermal_get_trend(struct thermal_zone_device *thermal, int trip, enum thermal_trend *trend) { - struct acpi_thermal *tz =3D thermal->devdata; + struct acpi_thermal *tz =3D thermal_zone_device_get_data(thermal); enum thermal_trip_type type; int i; =20 @@ -670,7 +670,7 @@ static int thermal_get_trend(struct thermal_zone_device= *thermal, =20 static void acpi_thermal_zone_device_hot(struct thermal_zone_device *therm= al) { - struct acpi_thermal *tz =3D thermal->devdata; + struct acpi_thermal *tz =3D thermal_zone_device_get_data(thermal); =20 acpi_bus_generate_netlink_event(tz->device->pnp.device_class, dev_name(&tz->device->dev), @@ -679,7 +679,7 @@ static void acpi_thermal_zone_device_hot(struct thermal= _zone_device *thermal) =20 static void acpi_thermal_zone_device_critical(struct thermal_zone_device *= thermal) { - struct acpi_thermal *tz =3D thermal->devdata; + struct acpi_thermal *tz =3D thermal_zone_device_get_data(thermal); =20 acpi_bus_generate_netlink_event(tz->device->pnp.device_class, dev_name(&tz->device->dev), @@ -693,7 +693,7 @@ static int acpi_thermal_cooling_device_cb(struct therma= l_zone_device *thermal, bool bind) { struct acpi_device *device =3D cdev->devdata; - struct acpi_thermal *tz =3D thermal->devdata; + struct acpi_thermal *tz =3D thermal_zone_device_get_data(thermal); struct acpi_device *dev; acpi_handle handle; int i; diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index a950767f7948..0ef928528aec 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -418,7 +418,7 @@ static int __sata_ahci_read_temperature(void *dev, int = *temp) =20 static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int = *temp) { - return __sata_ahci_read_temperature(tz->devdata, temp); + return __sata_ahci_read_temperature(thermal_zone_device_get_data(tz), tem= p); } =20 static ssize_t sata_ahci_show_temp(struct device *dev, diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 33edb5c02f7d..b33477d04c2b 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -154,7 +154,7 @@ static DEFINE_IDA(hwmon_ida); #ifdef CONFIG_THERMAL_OF static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *tem= p) { - struct hwmon_thermal_data *tdata =3D tz->devdata; + struct hwmon_thermal_data *tdata =3D thermal_zone_device_get_data(tz); struct hwmon_device *hwdev =3D to_hwmon_device(tdata->dev); int ret; long t; @@ -171,7 +171,7 @@ static int hwmon_thermal_get_temp(struct thermal_zone_d= evice *tz, int *temp) =20 static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low= , int high) { - struct hwmon_thermal_data *tdata =3D tz->devdata; + struct hwmon_thermal_data *tdata =3D thermal_zone_device_get_data(tz); struct hwmon_device *hwdev =3D to_hwmon_device(tdata->dev); const struct hwmon_chip_info *chip =3D hwdev->chip; const struct hwmon_channel_info **info =3D chip->info; diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_c= ore.c index 95e95783972a..159a88af6277 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1272,7 +1272,7 @@ struct pmbus_thermal_data { =20 static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *tem= p) { - struct pmbus_thermal_data *tdata =3D tz->devdata; + struct pmbus_thermal_data *tdata =3D thermal_zone_device_get_data(tz); struct pmbus_sensor *sensor =3D tdata->sensor; struct pmbus_data *pmbus_data =3D tdata->pmbus_data; struct i2c_client *client =3D to_i2c_client(pmbus_data->dev); diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index e192f0c67146..7951b6026f48 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -141,7 +141,7 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_z= one_device *tz, { int ret; long value; - struct scmi_thermal_sensor *th_sensor =3D tz->devdata; + struct scmi_thermal_sensor *th_sensor =3D thermal_zone_device_get_data(tz= ); =20 ret =3D scmi_hwmon_read_scaled_value(th_sensor->ph, th_sensor->info, &value); diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c index 4d75385f7d5e..efe0ddbc5293 100644 --- a/drivers/hwmon/scpi-hwmon.c +++ b/drivers/hwmon/scpi-hwmon.c @@ -64,7 +64,7 @@ static void scpi_scale_reading(u64 *value, struct sensor_= data *sensor) =20 static int scpi_read_temp(struct thermal_zone_device *tz, int *temp) { - struct scpi_thermal_zone *zone =3D tz->devdata; + struct scpi_thermal_zone *zone =3D thermal_zone_device_get_data(tz); struct scpi_sensors *scpi_sensors =3D zone->scpi_sensors; struct scpi_ops *scpi_ops =3D scpi_sensors->scpi_ops; struct sensor_data *sensor =3D &scpi_sensors->data[zone->sensor_id]; diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpad= c-iio.c index a6ade70dedf8..e24ac3ee8a35 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -414,7 +414,7 @@ static int sun4i_gpadc_runtime_resume(struct device *de= v) =20 static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sun4i_gpadc_iio *info =3D tz->devdata; + struct sun4i_gpadc_iio *info =3D thermal_zone_device_get_data(tz); int val, scale, offset; =20 if (sun4i_gpadc_temp_read(info->indio_dev, &val)) diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscre= en/sun4i-ts.c index 73eb8f80be6e..5e5434ffe397 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -194,7 +194,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *t= s, int *temp) =20 static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp) { - return sun4i_get_temp(tz->devdata, temp); + return sun4i_get_temp(thermal_zone_device_get_data(tz), temp); } =20 static const struct thermal_zone_device_ops sun4i_ts_tz_ops =3D { diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c b/drivers/n= et/ethernet/chelsio/cxgb4/cxgb4_thermal.c index 95e1b415ba13..8b0d318feef4 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c @@ -12,7 +12,7 @@ static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev, int *temp) { - struct adapter *adap =3D tzdev->devdata; + struct adapter *adap =3D thermal_zone_device_get_data(tzdev); u32 param, val; int ret; =20 diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/n= et/ethernet/mellanox/mlxsw/core_thermal.c index c5240d38c9db..228b6ffaef98 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -201,7 +201,7 @@ mlxsw_thermal_module_trips_update(struct device *dev, s= truct mlxsw_core *core, static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev, struct thermal_cooling_device *cdev) { - struct mlxsw_thermal *thermal =3D tzdev->devdata; + struct mlxsw_thermal *thermal =3D thermal_zone_device_get_data(tzdev); struct device *dev =3D thermal->bus_info->dev; int i, err; =20 @@ -227,7 +227,7 @@ static int mlxsw_thermal_bind(struct thermal_zone_devic= e *tzdev, static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev, struct thermal_cooling_device *cdev) { - struct mlxsw_thermal *thermal =3D tzdev->devdata; + struct mlxsw_thermal *thermal =3D thermal_zone_device_get_data(tzdev); struct device *dev =3D thermal->bus_info->dev; int i; int err; @@ -249,7 +249,7 @@ static int mlxsw_thermal_unbind(struct thermal_zone_dev= ice *tzdev, static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev, int *p_temp) { - struct mlxsw_thermal *thermal =3D tzdev->devdata; + struct mlxsw_thermal *thermal =3D thermal_zone_device_get_data(tzdev); struct device *dev =3D thermal->bus_info->dev; char mtmp_pl[MLXSW_REG_MTMP_LEN]; int temp; @@ -281,7 +281,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops= =3D { static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev, struct thermal_cooling_device *cdev) { - struct mlxsw_thermal_module *tz =3D tzdev->devdata; + struct mlxsw_thermal_module *tz =3D thermal_zone_device_get_data(tzdev); struct mlxsw_thermal *thermal =3D tz->parent; int i, j, err; =20 @@ -310,7 +310,7 @@ static int mlxsw_thermal_module_bind(struct thermal_zon= e_device *tzdev, static int mlxsw_thermal_module_unbind(struct thermal_zone_device *tzdev, struct thermal_cooling_device *cdev) { - struct mlxsw_thermal_module *tz =3D tzdev->devdata; + struct mlxsw_thermal_module *tz =3D thermal_zone_device_get_data(tzdev); struct mlxsw_thermal *thermal =3D tz->parent; int i; int err; @@ -356,7 +356,7 @@ mlxsw_thermal_module_temp_and_thresholds_get(struct mlx= sw_core *core, static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev, int *p_temp) { - struct mlxsw_thermal_module *tz =3D tzdev->devdata; + struct mlxsw_thermal_module *tz =3D thermal_zone_device_get_data(tzdev); struct mlxsw_thermal *thermal =3D tz->parent; int temp, crit_temp, emerg_temp; struct device *dev; @@ -391,7 +391,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_mod= ule_ops =3D { static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzde= v, int *p_temp) { - struct mlxsw_thermal_module *tz =3D tzdev->devdata; + struct mlxsw_thermal_module *tz =3D thermal_zone_device_get_data(tzdev); struct mlxsw_thermal *thermal =3D tz->parent; char mtmp_pl[MLXSW_REG_MTMP_LEN]; u16 index; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wire= less/intel/iwlwifi/mvm/tt.c index 232c200af38f..ee8fee29107f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -615,7 +615,7 @@ int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mv= m) static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device, int *temperature) { - struct iwl_mvm *mvm =3D (struct iwl_mvm *)device->devdata; + struct iwl_mvm *mvm =3D thermal_zone_device_get_data(device); int ret; int temp; =20 @@ -641,7 +641,7 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_d= evice *device, static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, int trip, int temp) { - struct iwl_mvm *mvm =3D (struct iwl_mvm *)device->devdata; + struct iwl_mvm *mvm =3D thermal_zone_device_get_data(device); struct iwl_mvm_thermal_device *tzone; int ret; =20 diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/suppl= y/power_supply_core.c index 7c790c41e2fe..166f0aacc797 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -1142,7 +1142,7 @@ static int power_supply_read_temp(struct thermal_zone= _device *tzd, int ret; =20 WARN_ON(tzd =3D=3D NULL); - psy =3D tzd->devdata; + psy =3D thermal_zone_device_get_data(tzd); ret =3D power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val); if (ret) return ret; diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8= 973-regulator.c index 7e00a45db26a..ccacba66d367 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -436,7 +436,7 @@ static int max8973_init_dcdc(struct max8973_chip *max, =20 static int max8973_thermal_read_temp(struct thermal_zone_device *tz, int *= temp) { - struct max8973_chip *mchip =3D tz->devdata; + struct max8973_chip *mchip =3D thermal_zone_device_get_data(tz); unsigned int val; int ret; =20 diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_ther= mal.c index 2efc222a379b..82d3e15d51f6 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -398,7 +398,7 @@ static int armada_read_sensor(struct armada_thermal_pri= v *priv, int *temp) static int armada_get_temp_legacy(struct thermal_zone_device *thermal, int *temp) { - struct armada_thermal_priv *priv =3D thermal->devdata; + struct armada_thermal_priv *priv =3D thermal_zone_device_get_data(thermal= ); int ret; =20 /* Valid check */ @@ -420,7 +420,7 @@ static struct thermal_zone_device_ops legacy_ops =3D { =20 static int armada_get_temp(struct thermal_zone_device *tz, int *temp) { - struct armada_thermal_sensor *sensor =3D tz->devdata; + struct armada_thermal_sensor *sensor =3D thermal_zone_device_get_data(tz); struct armada_thermal_priv *priv =3D sensor->priv; int ret; =20 diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/b= roadcom/bcm2711_thermal.c index 1f8651d15160..18b1a4d9ecc7 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -33,7 +33,7 @@ struct bcm2711_thermal_priv { =20 static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp) { - struct bcm2711_thermal_priv *priv =3D tz->devdata; + struct bcm2711_thermal_priv *priv =3D thermal_zone_device_get_data(tz); int slope =3D thermal_zone_get_slope(tz); int offset =3D thermal_zone_get_offset(tz); u32 val; diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/b= roadcom/bcm2835_thermal.c index 23918bb76ae6..de2f573863da 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -90,7 +90,7 @@ static int bcm2835_thermal_temp2adc(int temp, int offset,= int slope) =20 static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *t= emp) { - struct bcm2835_thermal_data *data =3D tz->devdata; + struct bcm2835_thermal_data *data =3D thermal_zone_device_get_data(tz); u32 val =3D readl(data->regs + BCM2835_TS_TSENSSTAT); =20 if (!(val & BCM2835_TS_TSENSSTAT_VALID)) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/b= roadcom/brcmstb_thermal.c index 4d02c28331e3..668cdc16b108 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -152,7 +152,7 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_= thermal_priv *priv, =20 static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) { - struct brcmstb_thermal_priv *priv =3D tz->devdata; + struct brcmstb_thermal_priv *priv =3D thermal_zone_device_get_data(tz); u32 val; long t; =20 @@ -262,7 +262,7 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, voi= d *data) =20 static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int = high) { - struct brcmstb_thermal_priv *priv =3D tz->devdata; + struct brcmstb_thermal_priv *priv =3D thermal_zone_device_get_data(tz); =20 dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high); =20 diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadc= om/ns-thermal.c index 07a8a3f49bd0..98296019ad4c 100644 --- a/drivers/thermal/broadcom/ns-thermal.c +++ b/drivers/thermal/broadcom/ns-thermal.c @@ -16,7 +16,7 @@ =20 static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - void __iomem *pvtmon =3D tz->devdata; + void __iomem *pvtmon =3D thermal_zone_device_get_data(tz); int offset =3D thermal_zone_get_offset(tz); int slope =3D thermal_zone_get_slope(tz); u32 val; diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadc= om/sr-thermal.c index 2b93502543ff..42b46125f409 100644 --- a/drivers/thermal/broadcom/sr-thermal.c +++ b/drivers/thermal/broadcom/sr-thermal.c @@ -32,7 +32,7 @@ struct sr_thermal { =20 static int sr_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sr_tmon *tmon =3D tz->devdata; + struct sr_tmon *tmon =3D thermal_zone_device_get_data(tz); struct sr_thermal *sr_thermal =3D tmon->priv; =20 *temp =3D readl(sr_thermal->regs + SR_TMON_TEMP_BASE(tmon->tmon_id)); diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-ther= mal.c index a805a6666c44..3d937f701e0b 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -123,7 +123,7 @@ static irqreturn_t da9062_thermal_irq_handler(int irq, = void *data) static int da9062_thermal_get_temp(struct thermal_zone_device *z, int *temp) { - struct da9062_thermal *thermal =3D z->devdata; + struct da9062_thermal *thermal =3D thermal_zone_device_get_data(z); =20 mutex_lock(&thermal->lock); *temp =3D thermal->temperature; diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 056622a58d00..ed7d1173d9fd 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c @@ -87,7 +87,7 @@ static int dove_get_temp(struct thermal_zone_device *ther= mal, int *temp) { unsigned long reg; - struct dove_thermal_priv *priv =3D thermal->devdata; + struct dove_thermal_priv *priv =3D thermal_zone_device_get_data(thermal); =20 /* Valid check */ reg =3D readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG); diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 32a7c3cf073d..043751e6a31d 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -431,7 +431,7 @@ static int hi3660_thermal_probe(struct hisi_thermal_dat= a *data) =20 static int hisi_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct hisi_thermal_sensor *sensor =3D tz->devdata; + struct hisi_thermal_sensor *sensor =3D thermal_zone_device_get_data(tz); struct hisi_thermal_data *data =3D sensor->data; =20 *temp =3D data->ops->get_temp(sensor); diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_ther= mal.c index 72b5d6f319c1..750240f4fa32 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -141,7 +141,7 @@ static int imx8mp_tmu_get_temp(void *data, int *temp) =20 static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tmu_sensor *sensor =3D tz->devdata; + struct tmu_sensor *sensor =3D thermal_zone_device_get_data(tz); struct imx8mm_tmu *tmu =3D sensor->priv; =20 return tmu->socdata->get_temp(sensor, temp); diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_ther= mal.c index f32e59e74623..ca10d6a68f0f 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -46,7 +46,7 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_de= vice *tz, int *temp) { struct imx_sc_msg_misc_get_temp msg; struct imx_sc_rpc_msg *hdr =3D &msg.hdr; - struct imx_sc_sensor *sensor =3D tz->devdata; + struct imx_sc_sensor *sensor =3D thermal_zone_device_get_data(tz); int ret; =20 msg.data.req.resource_id =3D sensor->resource_id; diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index fb0d5cab70af..c3c14cd26aee 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -252,7 +252,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data = *data, =20 static int imx_get_temp(struct thermal_zone_device *tz, int *temp) { - struct imx_thermal_data *data =3D tz->devdata; + struct imx_thermal_data *data =3D thermal_zone_device_get_data(tz); const struct thermal_soc_data *soc_data =3D data->socdata; struct regmap *map =3D data->tempmon; unsigned int n_meas; @@ -311,7 +311,7 @@ static int imx_get_temp(struct thermal_zone_device *tz,= int *temp) static int imx_change_mode(struct thermal_zone_device *tz, enum thermal_device_mode mode) { - struct imx_thermal_data *data =3D tz->devdata; + struct imx_thermal_data *data =3D thermal_zone_device_get_data(tz); =20 if (mode =3D=3D THERMAL_DEVICE_ENABLED) { pm_runtime_get(data->dev); @@ -342,7 +342,7 @@ static int imx_get_crit_temp(struct thermal_zone_device= *tz, int *temp) static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, int temp) { - struct imx_thermal_data *data =3D tz->devdata; + struct imx_thermal_data *data =3D thermal_zone_device_get_data(tz); int ret; =20 ret =3D pm_runtime_resume_and_get(data->dev); diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/in= tel/intel_pch_thermal.c index b855d031a855..e53f8a8c06e5 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -119,7 +119,7 @@ static int pch_wpt_add_acpi_psv_trip(struct pch_thermal= _device *ptd, int trip) =20 static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp) { - struct pch_thermal_device *ptd =3D tzd->devdata; + struct pch_thermal_device *ptd =3D thermal_zone_device_get_data(tzd); =20 *temp =3D GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); return 0; diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/i= ntel/intel_soc_dts_iosf.c index 8c26f7b2316b..f7d995722e04 100644 --- a/drivers/thermal/intel/intel_soc_dts_iosf.c +++ b/drivers/thermal/intel/intel_soc_dts_iosf.c @@ -54,7 +54,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *= tzd, int trip, struct intel_soc_dts_sensor_entry *dts; struct intel_soc_dts_sensors *sensors; =20 - dts =3D tzd->devdata; + dts =3D thermal_zone_device_get_data(tzd); sensors =3D dts->sensors; mutex_lock(&sensors->dts_update_lock); status =3D iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, @@ -168,7 +168,7 @@ static int update_trip_temp(struct intel_soc_dts_sensor= _entry *dts, static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { - struct intel_soc_dts_sensor_entry *dts =3D tzd->devdata; + struct intel_soc_dts_sensor_entry *dts =3D thermal_zone_device_get_data(t= zd); struct intel_soc_dts_sensors *sensors =3D dts->sensors; int status; =20 @@ -176,7 +176,7 @@ static int sys_set_trip_temp(struct thermal_zone_device= *tzd, int trip, return -EINVAL; =20 mutex_lock(&sensors->dts_update_lock); - status =3D update_trip_temp(tzd->devdata, trip, temp, + status =3D update_trip_temp(dts, trip, temp, dts->trip_types[trip]); mutex_unlock(&sensors->dts_update_lock); =20 @@ -186,9 +186,7 @@ static int sys_set_trip_temp(struct thermal_zone_device= *tzd, int trip, static int sys_get_trip_type(struct thermal_zone_device *tzd, int trip, enum thermal_trip_type *type) { - struct intel_soc_dts_sensor_entry *dts; - - dts =3D tzd->devdata; + struct intel_soc_dts_sensor_entry *dts =3D thermal_zone_device_get_data(t= zd); =20 *type =3D dts->trip_types[trip]; =20 @@ -200,11 +198,10 @@ static int sys_get_curr_temp(struct thermal_zone_devi= ce *tzd, { int status; u32 out; - struct intel_soc_dts_sensor_entry *dts; + struct intel_soc_dts_sensor_entry *dts =3D thermal_zone_device_get_data(t= zd); struct intel_soc_dts_sensors *sensors; unsigned long raw; =20 - dts =3D tzd->devdata; sensors =3D dts->sensors; status =3D iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, SOC_DTS_OFFSET_TEMP, &out); diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal= /intel/x86_pkg_temp_thermal.c index 1c2de84742df..22f0f206d8f2 100644 --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c @@ -107,7 +107,7 @@ static struct zone_device *pkg_temp_thermal_get_dev(uns= igned int cpu) =20 static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) { - struct zone_device *zonedev =3D tzd->devdata; + struct zone_device *zonedev =3D thermal_zone_device_get_data(tzd); int val; =20 val =3D intel_tcc_get_temp(zonedev->cpu, true); @@ -122,7 +122,7 @@ static int sys_get_curr_temp(struct thermal_zone_device= *tzd, int *temp) static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { - struct zone_device *zonedev =3D tzd->devdata; + struct zone_device *zonedev =3D thermal_zone_device_get_data(tzd); u32 l, h, mask, shift, intr; int tj_max, ret; =20 diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c index 22c9bcb899c3..8cbd7361b492 100644 --- a/drivers/thermal/k3_bandgap.c +++ b/drivers/thermal/k3_bandgap.c @@ -141,7 +141,7 @@ static int k3_bgp_read_temp(struct k3_thermal_data *dev= data, =20 static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct k3_thermal_data *data =3D tz->devdata; + struct k3_thermal_data *data =3D thermal_zone_device_get_data(tz); int ret =3D 0; =20 ret =3D k3_bgp_read_temp(data, temp); diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_= bandgap.c index 031ea1091909..300a3f985776 100644 --- a/drivers/thermal/k3_j72xx_bandgap.c +++ b/drivers/thermal/k3_j72xx_bandgap.c @@ -248,7 +248,7 @@ static inline int k3_bgp_read_temp(struct k3_thermal_da= ta *devdata, /* Get temperature callback function for thermal zone */ static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - return k3_bgp_read_temp(tz->devdata, temp); + return k3_bgp_read_temp(thermal_zone_device_get_data(tz), temp); } =20 static const struct thermal_zone_device_ops k3_of_thermal_ops =3D { diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_= thermal.c index bec7ec20e79d..8e39c875ba58 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c @@ -27,7 +27,7 @@ static int kirkwood_get_temp(struct thermal_zone_device *= thermal, int *temp) { unsigned long reg; - struct kirkwood_thermal_priv *priv =3D thermal->devdata; + struct kirkwood_thermal_priv *priv =3D thermal_zone_device_get_data(therm= al); =20 reg =3D readl_relaxed(priv->sensor); =20 diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_= thermal.c index 6451a55eb582..05b6e9a2a283 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -46,7 +46,7 @@ struct max77620_therm_info { =20 static int max77620_thermal_read_temp(struct thermal_zone_device *tz, int = *temp) { - struct max77620_therm_info *mtherm =3D tz->devdata; + struct max77620_therm_info *mtherm =3D thermal_zone_device_get_data(tz); unsigned int val; int ret; =20 diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/me= diatek/auxadc_thermal.c index ab730f9552d0..d7bf725d224b 100644 --- a/drivers/thermal/mediatek/auxadc_thermal.c +++ b/drivers/thermal/mediatek/auxadc_thermal.c @@ -763,7 +763,7 @@ static int mtk_thermal_bank_temperature(struct mtk_ther= mal_bank *bank) =20 static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature) { - struct mtk_thermal *mt =3D tz->devdata; + struct mtk_thermal *mt =3D thermal_zone_device_get_data(tz); int i; int tempmax =3D INT_MIN; =20 diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/medi= atek/lvts_thermal.c index 84ba65a27acf..86d280187c83 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperature) =20 static int lvts_get_temp(struct thermal_zone_device *tz, int *temp) { - struct lvts_sensor *lvts_sensor =3D tz->devdata; + struct lvts_sensor *lvts_sensor =3D thermal_zone_device_get_data(tz); void __iomem *msr =3D lvts_sensor->msr; u32 value; =20 @@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz= , int *temp) =20 static int lvts_set_trips(struct thermal_zone_device *tz, int low, int hig= h) { - struct lvts_sensor *lvts_sensor =3D tz->devdata; + struct lvts_sensor *lvts_sensor =3D thermal_zone_device_get_data(tz); void __iomem *base =3D lvts_sensor->base; u32 raw_low =3D lvts_temp_to_raw(low); u32 raw_high =3D lvts_temp_to_raw(high); diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qco= m/qcom-spmi-adc-tm5.c index 31164ade2dd1..b0269daf128a 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -360,7 +360,7 @@ static irqreturn_t adc_tm5_gen2_isr(int irq, void *data) =20 static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp) { - struct adc_tm5_channel *channel =3D tz->devdata; + struct adc_tm5_channel *channel =3D thermal_zone_device_get_data(tz); int ret; =20 if (!channel || !channel->iio) @@ -642,7 +642,7 @@ static int adc_tm5_gen2_configure(struct adc_tm5_channe= l *channel, int low, int =20 static int adc_tm5_set_trips(struct thermal_zone_device *tz, int low, int = high) { - struct adc_tm5_channel *channel =3D tz->devdata; + struct adc_tm5_channel *channel =3D thermal_zone_device_get_data(tz); struct adc_tm5_chip *chip; int ret; =20 diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/= qcom/qcom-spmi-temp-alarm.c index 101c75d0e13f..c817b03deb00 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -187,7 +187,7 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_ch= ip *chip) =20 static int qpnp_tm_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qpnp_tm_chip *chip =3D tz->devdata; + struct qpnp_tm_chip *chip =3D thermal_zone_device_get_data(tz); int ret, mili_celsius; =20 if (!temp) @@ -265,7 +265,7 @@ static int qpnp_tm_update_critical_trip_temp(struct qpn= p_tm_chip *chip, =20 static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_= id, int temp) { - struct qpnp_tm_chip *chip =3D tz->devdata; + struct qpnp_tm_chip *chip =3D thermal_zone_device_get_data(tz); struct thermal_trip trip; int ret; =20 diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_therma= l.c index 431c29c0898a..8b6fe0c9ade2 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -83,7 +83,7 @@ static struct qoriq_tmu_data *qoriq_sensor_to_data(struct= qoriq_sensor *s) =20 static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qoriq_sensor *qsensor =3D tz->devdata; + struct qoriq_sensor *qsensor =3D thermal_zone_device_get_data(tz); struct qoriq_tmu_data *qdata =3D qoriq_sensor_to_data(qsensor); u32 val; /* diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen= 3_thermal.c index d6b5b59c5c53..8ad713cb4bf7 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -167,7 +167,7 @@ static int rcar_gen3_thermal_round(int temp) =20 static int rcar_gen3_thermal_get_temp(struct thermal_zone_device *tz, int = *temp) { - struct rcar_gen3_thermal_tsc *tsc =3D tz->devdata; + struct rcar_gen3_thermal_tsc *tsc =3D thermal_zone_device_get_data(tz); int mcelsius, val; int reg; =20 @@ -206,7 +206,7 @@ static int rcar_gen3_thermal_mcelsius_to_temp(struct rc= ar_gen3_thermal_tsc *tsc, =20 static int rcar_gen3_thermal_set_trips(struct thermal_zone_device *tz, int= low, int high) { - struct rcar_gen3_thermal_tsc *tsc =3D tz->devdata; + struct rcar_gen3_thermal_tsc *tsc =3D thermal_zone_device_get_data(tz); u32 irqmsk =3D 0; =20 if (low !=3D -INT_MAX) { diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 436f5f9cf729..538ed6731589 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -101,7 +101,6 @@ struct rcar_thermal_priv { list_for_each_entry(pos, &common->head, list) =20 #define MCELSIUS(temp) ((temp) * 1000) -#define rcar_zone_to_priv(zone) ((zone)->devdata) #define rcar_priv_to_dev(priv) ((priv)->common->dev) #define rcar_has_irq_support(priv) ((priv)->common->base) #define rcar_id_to_shift(priv) ((priv)->id * 8) @@ -273,7 +272,7 @@ static int rcar_thermal_get_current_temp(struct rcar_th= ermal_priv *priv, =20 static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *te= mp) { - struct rcar_thermal_priv *priv =3D rcar_zone_to_priv(zone); + struct rcar_thermal_priv *priv =3D thermal_zone_device_get_data(zone); =20 return rcar_thermal_get_current_temp(priv, temp); } diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_= thermal.c index 4b7c43f34d1a..dafbdbb7c0c0 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1213,7 +1213,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(= int irq, void *dev) =20 static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int = low, int high) { - struct rockchip_thermal_sensor *sensor =3D tz->devdata; + struct rockchip_thermal_sensor *sensor =3D thermal_zone_device_get_data(t= z); struct rockchip_thermal_data *thermal =3D sensor->thermal; const struct rockchip_tsadc_chip *tsadc =3D thermal->chip; =20 @@ -1226,7 +1226,7 @@ static int rockchip_thermal_set_trips(struct thermal_= zone_device *tz, int low, i =20 static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *= out_temp) { - struct rockchip_thermal_sensor *sensor =3D tz->devdata; + struct rockchip_thermal_sensor *sensor =3D thermal_zone_device_get_data(t= z); struct rockchip_thermal_data *thermal =3D sensor->thermal; const struct rockchip_tsadc_chip *tsadc =3D sensor->thermal->chip; int retval; diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_therma= l.c index 2e0649f38506..d3ba2a74e42d 100644 --- a/drivers/thermal/rzg2l_thermal.c +++ b/drivers/thermal/rzg2l_thermal.c @@ -75,7 +75,7 @@ static inline void rzg2l_thermal_write(struct rzg2l_therm= al_priv *priv, u32 reg, =20 static int rzg2l_thermal_get_temp(struct thermal_zone_device *tz, int *tem= p) { - struct rzg2l_thermal_priv *priv =3D tz->devdata; + struct rzg2l_thermal_priv *priv =3D thermal_zone_device_get_data(tz); u32 result =3D 0, dsensor, ts_code_ave; int val, i; =20 diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung= /exynos_tmu.c index 527d1eb0663a..a2301e235a2b 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -645,7 +645,7 @@ static void exynos7_tmu_control(struct platform_device = *pdev, bool on) =20 static int exynos_get_temp(struct thermal_zone_device *tz, int *temp) { - struct exynos_tmu_data *data =3D tz->devdata; + struct exynos_tmu_data *data =3D thermal_zone_device_get_data(tz); int value, ret =3D 0; =20 if (!data || !data->tmu_read) @@ -723,7 +723,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_= tmu_data *data, =20 static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int te= mp) { - struct exynos_tmu_data *data =3D tz->devdata; + struct exynos_tmu_data *data =3D thermal_zone_device_get_data(tz); int ret =3D -EINVAL; =20 if (data->soc =3D=3D SOC_ARCH_EXYNOS4210) diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_therma= l.c index 6a722b10d738..62cd9305eb9c 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -31,7 +31,7 @@ struct spear_thermal_dev { static inline int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) { - struct spear_thermal_dev *stdev =3D thermal->devdata; + struct spear_thermal_dev *stdev =3D thermal_zone_device_get_data(thermal); =20 /* * Data are ready to be read after 628 usec from POWERDOWN signal @@ -48,7 +48,7 @@ static struct thermal_zone_device_ops ops =3D { static int __maybe_unused spear_thermal_suspend(struct device *dev) { struct thermal_zone_device *spear_thermal =3D dev_get_drvdata(dev); - struct spear_thermal_dev *stdev =3D spear_thermal->devdata; + struct spear_thermal_dev *stdev =3D thermal_zone_device_get_data(spear_th= ermal); unsigned int actual_mask =3D 0; =20 /* Disable SPEAr Thermal Sensor */ @@ -64,7 +64,7 @@ static int __maybe_unused spear_thermal_suspend(struct de= vice *dev) static int __maybe_unused spear_thermal_resume(struct device *dev) { struct thermal_zone_device *spear_thermal =3D dev_get_drvdata(dev); - struct spear_thermal_dev *stdev =3D spear_thermal->devdata; + struct spear_thermal_dev *stdev =3D thermal_zone_device_get_data(spear_th= ermal); unsigned int actual_mask =3D 0; int ret =3D 0; =20 @@ -154,7 +154,7 @@ static int spear_thermal_exit(struct platform_device *p= dev) { unsigned int actual_mask =3D 0; struct thermal_zone_device *spear_thermal =3D platform_get_drvdata(pdev); - struct spear_thermal_dev *stdev =3D spear_thermal->devdata; + struct spear_thermal_dev *stdev =3D thermal_zone_device_get_data(spear_th= ermal); =20 thermal_zone_device_unregister(spear_thermal); =20 diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index ac884514f116..69078a55dc0c 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -206,7 +206,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sp= rd_thermal_sensor *sen) =20 static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) { - struct sprd_thermal_sensor *sen =3D tz->devdata; + struct sprd_thermal_sensor *sen =3D thermal_zone_device_get_data(tz); u32 data; =20 data =3D readl(sen->data->base + SPRD_THM_TEMP(sen->id)) & diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_therma= l.c index 497beac63e5d..085b7b0b7c72 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -110,7 +110,7 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev, =20 static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsensor *s =3D tz->devdata; + struct tsensor *s =3D thermal_zone_device_get_data(tz); struct ths_device *tmdev =3D s->tmdev; int val =3D 0; =20 diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/t= egra/tegra-bpmp-thermal.c index 0b7a1a1948cb..31a660b009fc 100644 --- a/drivers/thermal/tegra/tegra-bpmp-thermal.c +++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c @@ -62,12 +62,14 @@ static int __tegra_bpmp_thermal_get_temp(struct tegra_b= pmp_thermal_zone *zone, =20 static int tegra_bpmp_thermal_get_temp(struct thermal_zone_device *tz, int= *out_temp) { - return __tegra_bpmp_thermal_get_temp(tz->devdata, out_temp); + struct tegra_bpmp_thermal_zone *zone =3D thermal_zone_device_get_data(tz); +=09 + return __tegra_bpmp_thermal_get_temp(zone, out_temp); } =20 static int tegra_bpmp_thermal_set_trips(struct thermal_zone_device *tz, in= t low, int high) { - struct tegra_bpmp_thermal_zone *zone =3D tz->devdata; + struct tegra_bpmp_thermal_zone *zone =3D thermal_zone_device_get_data(tz); struct mrq_thermal_host_to_bpmp_request req; struct tegra_bpmp_message msg; int err; diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegr= a/tegra30-tsensor.c index b3218b71b6d9..537413acc6d2 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -160,7 +160,7 @@ static void devm_tegra_tsensor_hw_disable(void *data) =20 static int tegra_tsensor_get_temp(struct thermal_zone_device *tz, int *tem= p) { - const struct tegra_tsensor_channel *tsc =3D tz->devdata; + const struct tegra_tsensor_channel *tsc =3D thermal_zone_device_get_data(= tz); const struct tegra_tsensor *ts =3D tsc->ts; int err, c1, c2, c3, c4, counter; u32 val; @@ -218,7 +218,7 @@ static int tegra_tsensor_temp_to_counter(const struct t= egra_tsensor *ts, int tem =20 static int tegra_tsensor_set_trips(struct thermal_zone_device *tz, int low= , int high) { - const struct tegra_tsensor_channel *tsc =3D tz->devdata; + const struct tegra_tsensor_channel *tsc =3D thermal_zone_device_get_data(= tz); const struct tegra_tsensor *ts =3D tsc->ts; u32 val; =20 diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/therma= l-generic-adc.c index 323e273e3298..8e2ff0df7e64 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -54,7 +54,7 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_i= nfo *gti, int val) =20 static int gadc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct gadc_thermal_info *gti =3D tz->devdata; + struct gadc_thermal_info *gti =3D thermal_zone_device_get_data(tz); int val; int ret; =20 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 0675df54c8e6..05e5a6bda695 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1378,6 +1378,12 @@ struct thermal_zone_device *thermal_zone_device_regi= ster(const char *type, int n } EXPORT_SYMBOL_GPL(thermal_zone_device_register); =20 +void *thermal_zone_device_get_data(struct thermal_zone_device *tzd) +{ + return tzd->devdata; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_get_data); + /** * thermal_zone_device_unregister - removes the registered thermal zone de= vice * @tz: the thermal zone device to remove diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c index ea616731066c..05a70205f86f 100644 --- a/drivers/thermal/thermal_mmio.c +++ b/drivers/thermal/thermal_mmio.c @@ -23,7 +23,7 @@ static u32 thermal_mmio_readb(void __iomem *mmio_base) static int thermal_mmio_get_temperature(struct thermal_zone_device *tz, in= t *temp) { int t; - struct thermal_mmio *sensor =3D tz->devdata; + struct thermal_mmio *sensor =3D thermal_zone_device_get_data(tz); =20 t =3D sensor->read_mmio(sensor->mmio_base) & sensor->mask; t *=3D sensor->factor; diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/t= hermal/ti-soc-thermal/ti-thermal-common.c index 8a9055bd376e..7f6b71d11eed 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -68,7 +68,7 @@ static inline int ti_thermal_hotspot_temperature(int t, i= nt s, int c) static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, in= t *temp) { struct thermal_zone_device *pcb_tz =3D NULL; - struct ti_thermal_data *data =3D tz->devdata; + struct ti_thermal_data *data =3D thermal_zone_device_get_data(tz); struct ti_bandgap *bgp; const struct ti_temp_sensor *s; int ret, tmp, slope, constant; @@ -109,7 +109,7 @@ static inline int __ti_thermal_get_temp(struct thermal_= zone_device *tz, int *tem =20 static int __ti_thermal_get_trend(struct thermal_zone_device *tz, int trip= , enum thermal_trend *trend) { - struct ti_thermal_data *data =3D tz->devdata; + struct ti_thermal_data *data =3D thermal_zone_device_get_data(tz); struct ti_bandgap *bgp; int id, tr, ret =3D 0; =20 diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_= thermal.c index 47801841b3f5..25247de7780c 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -187,7 +187,7 @@ static void uniphier_tm_disable_sensor(struct uniphier_= tm_dev *tdev) =20 static int uniphier_tm_get_temp(struct thermal_zone_device *tz, int *out_t= emp) { - struct uniphier_tm_dev *tdev =3D tz->devdata; + struct uniphier_tm_dev *tdev =3D thermal_zone_device_get_data(tz); struct regmap *map =3D tdev->regmap; int ret; u32 temp; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 2bb4bf33f4f3..724b95662da9 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -365,6 +365,8 @@ thermal_zone_device_register_with_trips(const char *, s= truct thermal_trip *, int void *, struct thermal_zone_device_ops *, struct thermal_zone_params *, int, int); =20 +void *thermal_zone_device_get_data(struct thermal_zone_device *tzd); + int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, unsigned long, unsigned long, --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 E1BBEC6FD1E for ; Sun, 19 Feb 2023 14:39:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230184AbjBSOia (ORCPT ); Sun, 19 Feb 2023 09:38:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230174AbjBSOh7 (ORCPT ); Sun, 19 Feb 2023 09:37:59 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98D1011645 for ; Sun, 19 Feb 2023 06:37:46 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id c3so489434wrb.6 for ; Sun, 19 Feb 2023 06:37:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jzE7tCtv9nXhTqCLmkAtvvd9XPqHKuG/dItaNXtPrVU=; b=OpBiHvkSLr05x1vk9n2mt2wFV84toJJTTuvndMhdR3wBSnUjGBpzbVeiJKoDf7uBWE kERcmA/sV+u8Ftr8cOhpKfQNHIcCv/Zh5/CrLsp93UCQK6KJHlejtamPW/Y7SA9XENR7 Bqq2lMyPu33A0fA4dxuKRI8S8o9zNiSmF2rGMhZIdUV2igOfr6kZAYudA6NdHZw1+lVx FAPUveDVijOr2Jc47zm9hUFfDw3d03p3LFDn+pA61gESR5L6a8VQ4qDzZHpDsMSyPL73 uD0uO5aSVbciyy592CGyamIZ7xWEsDp+V7dfNrLiYxgXsEGeNHdWw8hQddvHe2wfCm4T 4XsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jzE7tCtv9nXhTqCLmkAtvvd9XPqHKuG/dItaNXtPrVU=; b=z1l3kLHfp5fuqoL+YB/KgMJ9njN5HcAtKMPHApgHkt7sxAERSE/6KtdGxFArJSvojK CPswPIBS1KFReNYVpO2HXTUs/7KTlk58kxwBPAhHeG2czzYqin2LeIv8D1vUnHSCa6cH wnZFXMtUEPyCwr0OoeIEWrTB88xYTPxYVDSiMrqpuZPld52zn4Wb+rGJVmmZgcqO1GXC 3RgWAWbG9NsvtHC/IP0t3NwGiXSjc4A+ipADfY4NAoj22HiZwDHLWp5VOkFGB0IlNRwn 6MXv5PFueA8Dr7NRlAXDFfd89nCNsHA4DmTP+jFWKJmnpS6gG+hSCdTouDDKLnKiNC/Q Ee4g== X-Gm-Message-State: AO0yUKX9qnaxpFlh5faFQhlzXbl73wnBycMAT3MqAxW2TNONJSPjScHS k804E7R6dRWa1phRbxxVCpe005c22btWX+6B X-Google-Smtp-Source: AK7set9Xu4OAhco6//3XMOMWPsgze7O9LMLV6Zi0gxIz1V3EOVI2Imy0wZeqJKD3bkvngaxWR0FUEg== X-Received: by 2002:adf:fbcf:0:b0:2c5:62c8:5f43 with SMTP id d15-20020adffbcf000000b002c562c85f43mr1816465wrs.29.1676817464864; Sun, 19 Feb 2023 06:37:44 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:37:44 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui Subject: [PATCH v1 02/17] thermal/core: Show a debug message when get_temp() fails Date: Sun, 19 Feb 2023 15:36:42 +0100 Message-Id: <20230219143657.241542-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The different thermal drivers are showing an error in case the get_temp() fails. Actually no traces should be displayed in the backend ops but in the call site of this ops. Furthermore, the message is often a dev_dbg message where the tz->device is used, thus using the internal of the structure from the driver. Show a debug message if the thermal_zone_get_temp() fails to read the sensor temperature, so code showing the message is factored out and the tz->device accesss is in the scope of the thermal core framework. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_he= lpers.c index 0f648131b0b5..9558339f5633 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -107,6 +107,9 @@ int __thermal_zone_get_temp(struct thermal_zone_device = *tz, int *temp) *temp =3D tz->emul_temperature; } =20 + if (ret) + dev_dbg(&tz->device, "Failed to get temperature: %d\n", ret); +=09 return ret; } =20 --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 CA3A6C6FD1F for ; Sun, 19 Feb 2023 14:39:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbjBSOid (ORCPT ); Sun, 19 Feb 2023 09:38:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbjBSOiJ (ORCPT ); Sun, 19 Feb 2023 09:38:09 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28A1D3C06 for ; Sun, 19 Feb 2023 06:37:48 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id e2so658713wri.12 for ; Sun, 19 Feb 2023 06:37:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j3HcXJPInywKBgGcqF6ehgI3cQr8CSQVATX0aePHQ3M=; b=LjJ/qHYASPdsd1Kziy6v1qEg/SkK3Sj4RyOlQyDAe7vFDb5w7C4MJHGb/dQCxG87tD roha2s2C5xx5YKt+HUCusIC571yeUlRy4Mh83nZOEH8eiJzTZtxh/zvr6kVNO6tr7Pz0 wtJ9zzhUjASiyecs88MC3EJ7kqdjDqETBZIB68uAf7zhh6TMrSMgkBWcH9/M/aEpNHNE +CgVGL8z9oNDANgXnrVktmfA5Qos0KnVCLNvWWJsCab+QQt8I0+/lLJaHv7mpQvOh3n3 Y6GxKVBtW04dhr5QBqqLyIWiMdjAC9v1iGQISuqiDRSp8k57rPHYqL/BkwWfgjSQDAS7 QV9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j3HcXJPInywKBgGcqF6ehgI3cQr8CSQVATX0aePHQ3M=; b=Rz9UM1JOwvza4iFbCUVyKSt5JSRH8gN050HBdnYOmk7R58s/iJDxyZjE5QbGswE4D0 GlHEpTrXfX1tLq+iC2mWKWLcHaiyuDxubeVlmNbPhwlja3bWP+Q9RamUyPwpkRurqTov Ra4PJwsPwkNWh3gtyx85+ZNitBCbrd/q613DU7ybC4xcdoBodW/+ODl/dm7XgY7gWP3U /T5OJzHNnSP5U3YXRoxbsnuxWnVUVSYXlVnJkecMGjwBA8ZW/MmZ5KsJ7lAJGy7OfUxT r7xTezAaXiSpRmWU+QtwCxY/j7b6TckSvzKmBsSjGNP2Xt2xWqunnZxiXCbZMEZr4/2q EYsA== X-Gm-Message-State: AO0yUKX0x0XWK3JxFRJZSmcS6cEhlAPzJA2WWj4996qdavKz96A6GB2G LTO/SsGm+EHfUi8QdkD5UhU0SA== X-Google-Smtp-Source: AK7set/2WPrwPq6V9ybFOt9Qcc5CrgB6A95D6Z+phRCsM8QfU2fdMH319V3xcu31kSWHJQ8569YqOw== X-Received: by 2002:adf:e483:0:b0:2c5:5984:6efe with SMTP id i3-20020adfe483000000b002c559846efemr2076803wrm.47.1676817467210; Sun, 19 Feb 2023 06:37:47 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:37:46 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Miquel Raynal , Amit Kucheria , Zhang Rui , Markus Mayer , Broadcom internal kernel review list , Florian Fainelli , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Heiko Stuebner , linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support) Subject: [PATCH v1 03/17] thermal: Remove debug or error messages in get_temp() ops Date: Sun, 19 Feb 2023 15:36:43 +0100 Message-Id: <20230219143657.241542-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Some get_temp() ops implementation are showing an error or a debug message if the reading of the sensor fails. The debug message is already displayed from the call site of this ops. So we can remove it. On the other side, the error should not be displayed because in production that can raise tons of messages. Finally, some drivers are showing a debug message with the temperature, this is also accessible through the trace from the core code in the temperature_update() function. Another benefit is the dev_* messages are accessing the thermal zone device field from the structure, so we encapsulate even more the code by preventing these accesses. Remove those messages. Signed-off-by: Daniel Lezcano Reviewed-by: Miquel Raynal --- drivers/thermal/armada_thermal.c | 10 ++-------- drivers/thermal/broadcom/brcmstb_thermal.c | 4 +--- drivers/thermal/dove_thermal.c | 5 +---- drivers/thermal/hisi_thermal.c | 3 --- drivers/thermal/imx_sc_thermal.c | 5 +---- drivers/thermal/imx_thermal.c | 4 +--- drivers/thermal/kirkwood_thermal.c | 5 +---- drivers/thermal/max77620_thermal.c | 4 +--- drivers/thermal/rockchip_thermal.c | 3 --- drivers/thermal/st/st_thermal.c | 2 -- drivers/thermal/thermal-generic-adc.c | 5 ++--- 11 files changed, 10 insertions(+), 40 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_ther= mal.c index 82d3e15d51f6..9bbebde09dc4 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -360,11 +360,8 @@ static int armada_select_channel(struct armada_thermal= _priv *priv, int channel) * we must absolutely wait for the sensor validity bit to ensure we read * actual data. */ - if (armada_wait_sensor_validity(priv)) { - dev_err(priv->dev, - "Temperature sensor reading not valid\n"); + if (armada_wait_sensor_validity(priv)) return -EIO; - } =20 return 0; } @@ -402,11 +399,8 @@ static int armada_get_temp_legacy(struct thermal_zone_= device *thermal, int ret; =20 /* Valid check */ - if (!armada_is_valid(priv)) { - dev_err(priv->dev, - "Temperature sensor reading not valid\n"); + if (!armada_is_valid(priv)) return -EIO; - } =20 /* Do the actual reading */ ret =3D armada_read_sensor(priv, temp); diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/b= roadcom/brcmstb_thermal.c index 668cdc16b108..ae1981506da0 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -158,10 +158,8 @@ static int brcmstb_get_temp(struct thermal_zone_device= *tz, int *temp) =20 val =3D __raw_readl(priv->tmon_base + AVS_TMON_STATUS); =20 - if (!(val & AVS_TMON_STATUS_valid_msk)) { - dev_err(priv->dev, "reading not valid\n"); + if (!(val & AVS_TMON_STATUS_valid_msk)) return -EIO; - } =20 val =3D (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; =20 diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index ed7d1173d9fd..9cd54740713f 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c @@ -91,11 +91,8 @@ static int dove_get_temp(struct thermal_zone_device *the= rmal, =20 /* Valid check */ reg =3D readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG); - if ((reg & PMU_TDC1_TEMP_VALID_MASK) =3D=3D 0x0) { - dev_err(&thermal->device, - "Temperature sensor reading not valid\n"); + if ((reg & PMU_TDC1_TEMP_VALID_MASK) =3D=3D 0x0) return -EIO; - } =20 /* * Calculate temperature. According to Marvell internal diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 043751e6a31d..1e13fe80a9f3 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -436,9 +436,6 @@ static int hisi_thermal_get_temp(struct thermal_zone_de= vice *tz, int *temp) =20 *temp =3D data->ops->get_temp(sensor); =20 - dev_dbg(&data->pdev->dev, "tzd=3D%p, id=3D%d, temp=3D%d, thres=3D%d\n", - sensor->tzd, sensor->id, *temp, sensor->thres_temp); - return 0; } =20 diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_ther= mal.c index ca10d6a68f0f..26102d1c6bde 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -58,11 +58,8 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_d= evice *tz, int *temp) hdr->size =3D 2; =20 ret =3D imx_scu_call_rpc(thermal_ipc_handle, &msg, true); - if (ret) { - dev_err(&sensor->tzd->device, "read temp sensor %d failed, ret %d\n", - sensor->resource_id, ret); + if (ret) return ret; - } =20 *temp =3D msg.data.resp.celsius * 1000 + msg.data.resp.tenths * 100; =20 diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index c3c14cd26aee..f621b778b0f0 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -265,10 +265,8 @@ static int imx_get_temp(struct thermal_zone_device *tz= , int *temp) =20 regmap_read(map, soc_data->temp_data, &val); =20 - if ((val & soc_data->temp_valid_mask) =3D=3D 0) { - dev_dbg(&tz->device, "temp measurement never finished\n"); + if ((val & soc_data->temp_valid_mask) =3D=3D 0) return -EAGAIN; - } =20 n_meas =3D (val & soc_data->temp_value_mask) >> soc_data->temp_value_shift; diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_= thermal.c index 8e39c875ba58..f8c098a262fa 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c @@ -33,11 +33,8 @@ static int kirkwood_get_temp(struct thermal_zone_device = *thermal, =20 /* Valid check */ if (!((reg >> KIRKWOOD_THERMAL_VALID_OFFSET) & - KIRKWOOD_THERMAL_VALID_MASK)) { - dev_err(&thermal->device, - "Temperature sensor reading not valid\n"); + KIRKWOOD_THERMAL_VALID_MASK)) return -EIO; - } =20 /* * Calculate temperature. According to Marvell internal diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_= thermal.c index 05b6e9a2a283..1dad8cb00735 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -51,10 +51,8 @@ static int max77620_thermal_read_temp(struct thermal_zon= e_device *tz, int *temp) int ret; =20 ret =3D regmap_read(mtherm->rmap, MAX77620_REG_STATLBT, &val); - if (ret < 0) { - dev_err(mtherm->dev, "Failed to read STATLBT: %d\n", ret); + if (ret < 0) return ret; - } =20 if (val & MAX77620_IRQ_TJALRM2_MASK) *temp =3D MAX77620_TJALARM2_TEMP; diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_= thermal.c index dafbdbb7c0c0..bd593ec712ee 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1233,9 +1233,6 @@ static int rockchip_thermal_get_temp(struct thermal_z= one_device *tz, int *out_te =20 retval =3D tsadc->get_temp(&tsadc->table, sensor->id, thermal->regs, out_temp); - dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n", - sensor->id, *out_temp, retval); - return retval; } =20 diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_therma= l.c index 1009f08e64e3..4d39626a4345 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -127,8 +127,6 @@ static int st_thermal_get_temp(struct thermal_zone_devi= ce *th, int *temperature) temp +=3D sensor->cdata->temp_adjust_val; temp =3D mcelsius(temp); =20 - dev_dbg(dev, "temperature: %d\n", temp); - *temperature =3D temp; =20 return 0; diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/therma= l-generic-adc.c index 8e2ff0df7e64..7f3eda31d0fa 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -59,10 +59,9 @@ static int gadc_thermal_get_temp(struct thermal_zone_dev= ice *tz, int *temp) int ret; =20 ret =3D iio_read_channel_processed(gti->channel, &val); - if (ret < 0) { - dev_err(gti->dev, "IIO channel read failed %d\n", ret); + if (ret < 0) return ret; - } + *temp =3D gadc_thermal_adc_to_temp(gti, val); =20 return 0; --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 3C4D3C74A5B for ; Sun, 19 Feb 2023 14:39:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230289AbjBSOil (ORCPT ); Sun, 19 Feb 2023 09:38:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbjBSOiP (ORCPT ); Sun, 19 Feb 2023 09:38:15 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A767244BD for ; Sun, 19 Feb 2023 06:37:50 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id b10so387525wrx.11 for ; Sun, 19 Feb 2023 06:37:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZBM2HLbB7Qo2vrqksOEYa7EgLUWtFIg5RRT002O5Ssg=; b=TO7rXVsQB/BoHeThuen3HLeXQHw8uFprFnlev4VHb9WQJdr9MqzXViD/0rYqylC0Rw s4Ydh1MYUjdBbReo7dllBAVqGlJZs1MOUyqgYFUR82QQh2MqtzFJ2TrMBke6DUHh9N43 //zRkHnXreU8VL/l61BRD6YxnihTJkWYBuKUbH15OL3y/osv3jhrCdtcfW7No3rMYa74 UJp7T9khNs0QYhw5CTYiMG+FC/QUeHsyFYPsEOZUrF2icAL9EBcs+4U5+zHKI+yH032S ZsP0ZYFeAc6VjzNRrXXx9Wecy8cx7RCTtycaDNLD8snjHeNR4jbYY1Pcvg6Ude5C/Wys kY3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZBM2HLbB7Qo2vrqksOEYa7EgLUWtFIg5RRT002O5Ssg=; b=Uh4Od2XM5WNlr5aYpXd+eHmEgex8/URbsxXCD2WugEXR7u/Z2hX7VL5Suiuqs9A0wi ATRFrQV0uh0uktiVG5xSXxpvs+kWBuYTWR1tWB3IqFx9Aug+F199O6Z7AoceTIcxhQIt dnzrsrD+AecgA0TH7zzdGMPsOsf3CBlLdpxxMoZajmFizIaPdExioLtFZXqxqn/VYiq/ +zIzd53EMzJUG4A1svyme5WO9MFXD2paryia5rvToVX0x99Yayu2ICvN6HBSJAaQiHUv ULJfcavvuq2Skd4kRpUn9PJfD9FJ2znus9E87pLk8fzqRBwy5aBDYLPIUjELyKyeKtNd Q1rA== X-Gm-Message-State: AO0yUKUebZPPzA+p+B/whhkHpjlKMcfdTqioLho2pKiPhF30gol5p46S PkrJRYTKmiePq+9SbyIeHbh48Q== X-Google-Smtp-Source: AK7set96jPynxhIQdIbJZonMo9LO2io3qFPWwv72HTl60NTbFsEOHnGT0e8IIoi5ybFAdP9jLCZpaw== X-Received: by 2002:a05:6000:98c:b0:2c5:5ee9:6b27 with SMTP id by12-20020a056000098c00b002c55ee96b27mr136802wrb.13.1676817470123; Sun, 19 Feb 2023 06:37:50 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:37:49 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Heiko Stuebner , Stefan Wahren , Kunihiko Hayashi , Miquel Raynal , Neil Armstrong , ye xingchen , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR THERMAL DRIVERS), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support) Subject: [PATCH v1 04/17] thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs() Date: Sun, 19 Feb 2023 15:36:44 +0100 Message-Id: <20230219143657.241542-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal->tzp->no_hwmon parameter is only used when calling thermal_zone_device_register(). Setting it to 'false' before calling thermal_add_hwmon_sysfs() has no effect. Remove the call and again prevent the drivers to access the thermal internals. Signed-off-by: Daniel Lezcano Reviewed-by: Niklas S=C3=B6derlund --- drivers/thermal/broadcom/bcm2711_thermal.c | 1 - drivers/thermal/broadcom/bcm2835_thermal.c | 1 - drivers/thermal/rcar_gen3_thermal.c | 1 - drivers/thermal/rcar_thermal.c | 5 ----- drivers/thermal/rockchip_thermal.c | 1 - drivers/thermal/rzg2l_thermal.c | 1 - 6 files changed, 10 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/b= roadcom/bcm2711_thermal.c index 18b1a4d9ecc7..0a499435431c 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -98,7 +98,6 @@ static int bcm2711_thermal_probe(struct platform_device *= pdev) =20 priv->thermal =3D thermal; =20 - thermal->tzp->no_hwmon =3D false; return thermal_add_hwmon_sysfs(thermal); } =20 diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/b= roadcom/bcm2835_thermal.c index de2f573863da..8ed7a80122a0 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -267,7 +267,6 @@ static int bcm2835_thermal_probe(struct platform_device= *pdev) * Thermal_zone doesn't enable hwmon as default, * enable it here */ - tz->tzp->no_hwmon =3D false; err =3D thermal_add_hwmon_sysfs(tz); if (err) goto err_tz; diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen= 3_thermal.c index 8ad713cb4bf7..4ea9d4bd8e6f 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -527,7 +527,6 @@ static int rcar_gen3_thermal_probe(struct platform_devi= ce *pdev) } tsc->zone =3D zone; =20 - tsc->zone->tzp->no_hwmon =3D false; ret =3D thermal_add_hwmon_sysfs(tsc->zone); if (ret) goto error_unregister; diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 538ed6731589..919f0e32d3c5 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -509,11 +509,6 @@ static int rcar_thermal_probe(struct platform_device *= pdev) } =20 if (chip->use_of_thermal) { - /* - * thermal_zone doesn't enable hwmon as default, - * but, enable it here to keep compatible - */ - priv->zone->tzp->no_hwmon =3D false; ret =3D thermal_add_hwmon_sysfs(priv->zone); if (ret) goto error_unregister; diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_= thermal.c index bd593ec712ee..3211b70c85b9 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1451,7 +1451,6 @@ static int rockchip_thermal_probe(struct platform_dev= ice *pdev) =20 for (i =3D 0; i < thermal->chip->chn_num; i++) { rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); - thermal->sensors[i].tzd->tzp->no_hwmon =3D false; error =3D thermal_add_hwmon_sysfs(thermal->sensors[i].tzd); if (error) dev_warn(&pdev->dev, diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_therma= l.c index d3ba2a74e42d..a2f21c941cfe 100644 --- a/drivers/thermal/rzg2l_thermal.c +++ b/drivers/thermal/rzg2l_thermal.c @@ -216,7 +216,6 @@ static int rzg2l_thermal_probe(struct platform_device *= pdev) } =20 priv->zone =3D zone; - priv->zone->tzp->no_hwmon =3D false; ret =3D thermal_add_hwmon_sysfs(priv->zone); if (ret) goto err; --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 171D6C6FD20 for ; Sun, 19 Feb 2023 14:39:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230249AbjBSOih (ORCPT ); Sun, 19 Feb 2023 09:38:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjBSOiW (ORCPT ); Sun, 19 Feb 2023 09:38:22 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6113510F9 for ; Sun, 19 Feb 2023 06:37:58 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id bg33so879724wmb.1 for ; Sun, 19 Feb 2023 06:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K/N/PusoT+hDJ8mhxwt7gAFO4vRcraA+apO1+Zvf8Ao=; b=dXdJbs92siaoCYwl/ajGVp4YuI2jjPE4kHE41wCR9fO+GllbGhGOjR2ARb2+k45MkY oe9bNl6ueGIKEUWQmV7PX9WpZ6o7HrZQIDLG7r9TpgGlfUydarNL4iaY1MwvvCm4vOM+ HBkEYW3NzF7STStypOLML79Lpr4XLxXIiqgHBvreCxa1AgIFNuEVs4kzQ0ta/Vr47vUR y2cUJ104CHPVm3RN6WLFXs9sAr9MC58rvhRq1/F4UCX/n4hiwBctWjbGutT4CFicQyD9 hU3sBDcowGUs1Fa+hi8ID1FB+XguXSKJtgRHvNFoWsJowAxolE2aeN6vZG3ypPYnA4U0 AdyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K/N/PusoT+hDJ8mhxwt7gAFO4vRcraA+apO1+Zvf8Ao=; b=eoesLjdT8HKWWmnagl+UyOs6TVs0NMGsI7V8XRCQdiVdrYjyQ1q42YrPd6cLiO8xGE RFxpNYUOTa5IWGSvwvYEeHJs38R7Vb0CnH5/fKDiBnzE8rYGZksyAJ1DC/machH/xYLy wQodIOhaJo4D/MOCC2haoTQZl8eCNcIq1fOlm2aSa5yWeg73JCoWxeGGI9tYuh6VWIUV jeCMMSCSpeM5tbUhWuJ4ADtKLuYX2tYTtaxo7ICJw2KrEOQfv4uWq17M1my+hJr9C+Qh hcuM5+01UqAQl4HERaiBgIDxXNsoIGPIsjmLMX7AJ+em3hHW/A33fxtx09rnxgIk+S2d fgiQ== X-Gm-Message-State: AO0yUKWmb+RIcXVybYzTApsmErlegDmHw2GwByA31Sf1s0aXbWetQAG6 /GojLHn42CDJwzgvuIxF75pAog== X-Google-Smtp-Source: AK7set92wguRhlEv6GXujA4tqELo1AZxoqd4sByefmk7Dqmh3mm+83wnvuaS9sAzZifH5oTtjzoYoA== X-Received: by 2002:a05:600c:4b10:b0:3e2:9b4:4303 with SMTP id i16-20020a05600c4b1000b003e209b44303mr9955738wmp.19.1676817476807; Sun, 19 Feb 2023 06:37:56 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:37:56 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Guillaume La Roque , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno , Daniel Golle , ye xingchen , Randy Dunlap , Balsam CHIHI , Miquel Raynal , Kunihiko Hayashi , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , linux-amlogic@lists.infradead.org (open list:THERMAL DRIVER FOR AMLOGIC SOCS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE), linux-arm-msm@vger.kernel.org (open list:QUALCOMM TSENS THERMAL DRIVER), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v1 05/17] thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() Date: Sun, 19 Feb 2023 15:36:45 +0100 Message-Id: <20230219143657.241542-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The devres variant of thermal_add_hwmon_sysfs() only takes the thermal zone structure pointer as parameter. Actually, it uses the tz->device to add it in the devres list. It is preferable to use the device registering the thermal zone instead of the thermal zone device itself. That prevents the driver accessing the thermal zone structure internals and it is from my POV more correct regarding how devm_ is used. Signed-off-by: Daniel Lezcano Acked-by: Martin Blumenstingl --- drivers/thermal/amlogic_thermal.c | 2 +- drivers/thermal/imx8mm_thermal.c | 2 +- drivers/thermal/imx_sc_thermal.c | 2 +- drivers/thermal/k3_bandgap.c | 2 +- drivers/thermal/mediatek/auxadc_thermal.c | 2 +- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 2 +- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 2 +- drivers/thermal/qcom/tsens.c | 2 +- drivers/thermal/qoriq_thermal.c | 2 +- drivers/thermal/sun8i_thermal.c | 2 +- drivers/thermal/tegra/tegra30-tsensor.c | 2 +- drivers/thermal/thermal_hwmon.c | 4 ++-- drivers/thermal/thermal_hwmon.h | 4 ++-- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_th= ermal.c index 9235fda4ec1e..337153042318 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -285,7 +285,7 @@ static int amlogic_thermal_probe(struct platform_device= *pdev) return ret; } =20 - if (devm_thermal_add_hwmon_sysfs(pdata->tzd)) + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, pdata->tzd)) dev_warn(&pdev->dev, "Failed to add hwmon sysfs attributes\n"); =20 ret =3D amlogic_thermal_initialize(pdata); diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_ther= mal.c index 750240f4fa32..e0830dcec4a0 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -343,7 +343,7 @@ static int imx8mm_tmu_probe(struct platform_device *pde= v) } tmu->sensors[i].hw_id =3D i; =20 - if (devm_thermal_add_hwmon_sysfs(tmu->sensors[i].tzd)) + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, tmu->sensors[i].tzd)) dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n"); } =20 diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_ther= mal.c index 26102d1c6bde..631bda2401eb 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -116,7 +116,7 @@ static int imx_sc_thermal_probe(struct platform_device = *pdev) return ret; } =20 - if (devm_thermal_add_hwmon_sysfs(sensor->tzd)) + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd)) dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n"); } =20 diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c index 8cbd7361b492..ee059997d00d 100644 --- a/drivers/thermal/k3_bandgap.c +++ b/drivers/thermal/k3_bandgap.c @@ -222,7 +222,7 @@ static int k3_bandgap_probe(struct platform_device *pde= v) goto err_alloc; } =20 - if (devm_thermal_add_hwmon_sysfs(data[id].tzd)) + if (devm_thermal_add_hwmon_sysfs(dev, data[id].tzd)) dev_warn(dev, "Failed to add hwmon sysfs attributes\n"); } =20 diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/me= diatek/auxadc_thermal.c index d7bf725d224b..d4b8246d4991 100644 --- a/drivers/thermal/mediatek/auxadc_thermal.c +++ b/drivers/thermal/mediatek/auxadc_thermal.c @@ -1210,7 +1210,7 @@ static int mtk_thermal_probe(struct platform_device *= pdev) goto err_disable_clk_peri_therm; } =20 - ret =3D devm_thermal_add_hwmon_sysfs(tzdev); + ret =3D devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev); if (ret) dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs"); =20 diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qco= m/qcom-spmi-adc-tm5.c index b0269daf128a..e3c8c9dc93e2 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -689,7 +689,7 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *ad= c_tm) return PTR_ERR(tzd); } adc_tm->channels[i].tzd =3D tzd; - if (devm_thermal_add_hwmon_sysfs(tzd)) + if (devm_thermal_add_hwmon_sysfs(adc_tm->dev, tzd)) dev_warn(adc_tm->dev, "Failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/= qcom/qcom-spmi-temp-alarm.c index c817b03deb00..f82e0051d30e 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -459,7 +459,7 @@ static int qpnp_tm_probe(struct platform_device *pdev) return ret; } =20 - if (devm_thermal_add_hwmon_sysfs(chip->tz_dev)) + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev)) dev_warn(&pdev->dev, "Failed to add hwmon sysfs attributes\n"); =20 diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 8020ead2794e..49c1fdca36dd 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1189,7 +1189,7 @@ static int tsens_register(struct tsens_priv *priv) if (priv->ops->enable) priv->ops->enable(priv, i); =20 - if (devm_thermal_add_hwmon_sysfs(tzd)) + if (devm_thermal_add_hwmon_sysfs(priv->dev, tzd)) dev_warn(priv->dev, "Failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_therma= l.c index 8b6fe0c9ade2..e6f244d18c59 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -157,7 +157,7 @@ static int qoriq_tmu_register_tmu_zone(struct device *d= ev, return ret; } =20 - if (devm_thermal_add_hwmon_sysfs(tzd)) + if (devm_thermal_add_hwmon_sysfs(dev, tzd)) dev_warn(dev, "Failed to add hwmon sysfs attributes\n"); =20 diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_therma= l.c index 085b7b0b7c72..ec4aa60dd1fb 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -475,7 +475,7 @@ static int sun8i_ths_register(struct ths_device *tmdev) if (IS_ERR(tmdev->sensor[i].tzd)) return PTR_ERR(tmdev->sensor[i].tzd); =20 - if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd)) + if (devm_thermal_add_hwmon_sysfs(tmdev->dev, tmdev->sensor[i].tzd)) dev_warn(tmdev->dev, "Failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegr= a/tegra30-tsensor.c index 537413acc6d2..ceb5b1b338a9 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -528,7 +528,7 @@ static int tegra_tsensor_register_channel(struct tegra_= tsensor *ts, return 0; } =20 - if (devm_thermal_add_hwmon_sysfs(tsc->tzd)) + if (devm_thermal_add_hwmon_sysfs(ts->dev, tsc->tzd)) dev_warn(ts->dev, "failed to add hwmon sysfs attributes\n"); =20 return 0; diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmo= n.c index c594c42bea6d..964db7941e31 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -263,7 +263,7 @@ static void devm_thermal_hwmon_release(struct device *d= ev, void *res) thermal_remove_hwmon_sysfs(*(struct thermal_zone_device **)res); } =20 -int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) +int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_d= evice *tz) { struct thermal_zone_device **ptr; int ret; @@ -280,7 +280,7 @@ int devm_thermal_add_hwmon_sysfs(struct thermal_zone_de= vice *tz) } =20 *ptr =3D tz; - devres_add(&tz->device, ptr); + devres_add(dev, ptr); =20 return ret; } diff --git a/drivers/thermal/thermal_hwmon.h b/drivers/thermal/thermal_hwmo= n.h index 1a9d65f6a6a8..b429f6e7abdb 100644 --- a/drivers/thermal/thermal_hwmon.h +++ b/drivers/thermal/thermal_hwmon.h @@ -17,7 +17,7 @@ =20 #ifdef CONFIG_THERMAL_HWMON int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz); -int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz); +int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_d= evice *tz); void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz); #else static inline int @@ -27,7 +27,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) } =20 static inline int -devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) +devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_devic= e *tz) { return 0; } diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/t= hermal/ti-soc-thermal/ti-thermal-common.c index 7f6b71d11eed..9fb1ca5e39f6 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -182,7 +182,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, in= t id, ti_bandgap_set_sensor_data(bgp, id, data); ti_bandgap_write_update_interval(bgp, data->sensor_id, interval); =20 - if (devm_thermal_add_hwmon_sysfs(data->ti_thermal)) + if (devm_thermal_add_hwmon_sysfs(bgp->dev, data->ti_thermal)) dev_warn(bgp->dev, "failed to add hwmon sysfs attributes\n"); =20 return 0; --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 ADF1CC6FA9E for ; Sun, 19 Feb 2023 14:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230197AbjBSOjF (ORCPT ); Sun, 19 Feb 2023 09:39:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230159AbjBSOi3 (ORCPT ); Sun, 19 Feb 2023 09:38:29 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30DB5D518 for ; Sun, 19 Feb 2023 06:38:02 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id s17so439807wrt.8 for ; Sun, 19 Feb 2023 06:38:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7EQdLF9AMmZViuzogdladJM3zlJqNSRkNKe1zS5ZnYI=; b=aXegFSIkXQv1JoZZ2ID478L2wamqR2CpXLs41QNJ2HbICfoiWmARjCensgQr0CmSjk k38g+ZfDIb5NXJsuotUBK//NWtNqat2AnuwYoIIjdreZoU/JOB/Mbhc4dLjDjNzcs0jC Aei2Co1HYM3UiX/wp6UCShQIvKgqBoZRmdsgINIXJxoIKJQnPkHRaQoXZRTIruBdl9ic s2+qp6snTrQYSeJrFEgD7ZSbzvBM19JaJXGECoX+A/UpZYXH2n3P0fPkGSqvF/wDPzUW 6C8qPDIXjaUim9ubsJQZcRHyZM4mm/xKszEwt+LpNsisH+6LwP31rk0/Wl/5MUmKe27k y0mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7EQdLF9AMmZViuzogdladJM3zlJqNSRkNKe1zS5ZnYI=; b=USeYi9xxEnn5OM0RwQMjsndJbnf3p+5Ls8pXr+MLaW4B2bP8bKXFEWe94r17ghebqb /nbzyxzoVB5bp6pKGIh9LflQCwIFYfKL5bILBHRhQ1lrdxowXUouGG9iNLyvfmsWVhMI 9I6YUmGnXOTsRyToiM8TYbRmPFWE1+3AIvA8949XyuQ8PpGTbiGR47/51uAxd+7k98kM ig8z7oky3ldaeqm3e7qOKjxehJmdlzaNQKyRzQsxtWE/S04yvEj7Zg5OnPbuPIbDipCc LmB8Jxh9NozoPUTNKrp4iqolRDmPcLPnGF8T0i1lCksl/ZswV7SMyzKJSjD51tA8C4jb P0uQ== X-Gm-Message-State: AO0yUKWht8r+idh0a3aZs6a+szRXSPQR+NL0UeB0v6gDEaik2c+Ka6zB c28V42ST5v3PTxVOR9ipNXAUZw== X-Google-Smtp-Source: AK7set+K+odTdDXOhAcPev17M1CvFdDyh3vLK9WfS//7AmCsByfmu8ydKgygh0HKTOvtCI7dIvJQug== X-Received: by 2002:a05:6000:1244:b0:2c5:4f41:d1c1 with SMTP id j4-20020a056000124400b002c54f41d1c1mr1713392wrx.38.1676817481730; Sun, 19 Feb 2023 06:38:01 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:01 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno , Balsam CHIHI , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v1 06/17] thermal: Don't use 'device' internal thermal zone structure field Date: Sun, 19 Feb 2023 15:36:46 +0100 Message-Id: <20230219143657.241542-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Some drivers are directly using the thermal zone's 'device' structure field. Use the driver device pointer instead of the thermal zone device when it is available. Remove the traces when they are duplicate with the traces in the core code. Signed-off-by: Daniel Lezcano Reviewed-by: Balsam CHIHI --- drivers/thermal/imx_thermal.c | 37 ++++--------------- drivers/thermal/mediatek/lvts_thermal.c | 4 +- drivers/thermal/thermal_hwmon.c | 4 +- .../ti-soc-thermal/ti-thermal-common.c | 2 +- 4 files changed, 13 insertions(+), 34 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index f621b778b0f0..ae411477d3db 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -285,13 +285,13 @@ static int imx_get_temp(struct thermal_zone_device *t= z, int *temp) if (data->alarm_temp =3D=3D trips[IMX_TRIP_CRITICAL].temperature && *temp < trips[IMX_TRIP_PASSIVE].temperature) { imx_set_alarm_temp(data, trips[IMX_TRIP_PASSIVE].temperature); - dev_dbg(&tz->device, "thermal alarm off: T < %d\n", + dev_dbg(data->dev, "thermal alarm off: T < %d\n", data->alarm_temp / 1000); } } =20 if (*temp !=3D data->last_temp) { - dev_dbg(&tz->device, "millicelsius: %d\n", *temp); + dev_dbg(data->dev, "millicelsius: %d\n", *temp); data->last_temp =3D *temp; } =20 @@ -367,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_devi= ce *tz, int trip, static int imx_bind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev) { - int ret; - - ret =3D thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, - THERMAL_NO_LIMIT, - THERMAL_NO_LIMIT, - THERMAL_WEIGHT_DEFAULT); - if (ret) { - dev_err(&tz->device, - "binding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); - return ret; - } - - return 0; + return thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, + THERMAL_NO_LIMIT, + THERMAL_NO_LIMIT, + THERMAL_WEIGHT_DEFAULT); } =20 static int imx_unbind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev) { - int ret; - - ret =3D thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); - if (ret) { - dev_err(&tz->device, - "unbinding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); - return ret; - } - - return 0; + return thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); } =20 static struct thermal_zone_device_ops imx_tz_ops =3D { @@ -558,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq= , void *dev) { struct imx_thermal_data *data =3D dev; =20 - dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n", - data->alarm_temp / 1000); + dev_dbg(data->dev, "THERMAL ALARM: T > %d\n", data->alarm_temp / 1000); =20 thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED); =20 diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/medi= atek/lvts_thermal.c index 86d280187c83..a65a81114cc5 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -305,7 +305,7 @@ static int lvts_set_trips(struct thermal_zone_device *t= z, int low, int high) * 14-0 : Raw temperature for threshold */ if (low !=3D -INT_MAX) { - dev_dbg(&tz->device, "Setting low limit temperature interrupt: %d\n", lo= w); + pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, = low); writel(raw_low, LVTS_H2NTHRE(base)); } =20 @@ -318,7 +318,7 @@ static int lvts_set_trips(struct thermal_zone_device *t= z, int low, int high) * * 14-0 : Raw temperature for threshold */ - dev_dbg(&tz->device, "Setting high limit temperature interrupt: %d\n", hi= gh); + pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, = high); writel(raw_high, LVTS_HTHRE(base)); =20 return 0; diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmo= n.c index 964db7941e31..bc02095b314c 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -228,14 +228,14 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_d= evice *tz) hwmon =3D thermal_hwmon_lookup_by_type(tz); if (unlikely(!hwmon)) { /* Should never happen... */ - dev_dbg(&tz->device, "hwmon device lookup failed!\n"); + dev_dbg(hwmon->device, "hwmon device lookup failed!\n"); return; } =20 temp =3D thermal_hwmon_lookup_temp(hwmon, tz); if (unlikely(!temp)) { /* Should never happen... */ - dev_dbg(&tz->device, "temperature input lookup failed!\n"); + dev_dbg(hwmon->device, "temperature input lookup failed!\n"); return; } =20 diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/t= hermal/ti-soc-thermal/ti-thermal-common.c index 9fb1ca5e39f6..8586cfe92df6 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -43,7 +43,7 @@ static void ti_thermal_work(struct work_struct *work) =20 thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); =20 - dev_dbg(&data->ti_thermal->device, "updated thermal zone %s\n", + dev_dbg(data->bgp->dev, "updated thermal zone %s\n", data->ti_thermal->type); } =20 --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 BC725C76186 for ; Sun, 19 Feb 2023 14:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbjBSOjV (ORCPT ); Sun, 19 Feb 2023 09:39:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbjBSOia (ORCPT ); Sun, 19 Feb 2023 09:38:30 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A2388A7A for ; Sun, 19 Feb 2023 06:38:03 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id e2so659060wri.12 for ; Sun, 19 Feb 2023 06:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nwIPDKt1NKah2ZF5gKdn4z7lJuGWL0P0jWTGeT+NApM=; b=rko85JpPzkGDr7nw73V9ShJorcL22/szXUgHF7fomf0L9Bob5r/SBQe8DivWZpHPck Id/3qKIAZml1QfPMTJZ2R1/VJtkPrWSNKnZcxxWVMsr3NfvSyZ7vZ+9hT1qQrWpD8L02 3+FTd2fM/jBmJ2DnKNzHPWtCDiWFdbnunspXRUpvnT9MaSsrsnA4GOJwe1wGsWZtu6lE BVqtDot0lXNUpNhiQBmXYZ1k0/uTuVWmUZWCnfOog6O+dNuY1D8YE99I84dcK+U93VRv jiQPOcC1/h6aKO3XlyM5GSXsh5Eu4UiZV/TmsXsf//6js1Qqs4PGyggSk8WRvQqyJkmn UMhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nwIPDKt1NKah2ZF5gKdn4z7lJuGWL0P0jWTGeT+NApM=; b=wHmRfKdiqvXC4ZnXx3w2aJZFLvX+ZoH0aeM7n7QnLhyyf172xjOp7x3EvupYH3O4fq SG4W6yr/0QpIHGfJafpxA95WzbsEQZHd0a9BNa6QES97bpP+z6CqaAk2dEtDItse2Z8i /cXA8/jzrvxOFe33AeciMMp9HXBQ3eijpv6ICP8HaekcW4hq84EHN/cwLvOng+jf1iu+ m+4nGGN91liFlhe/AQIZ/fjFqdlqSadhRfeW4z1OQfkCHvyb/9JAnIsOU2/Wj1TpjpUO DDmmtp+akmHVJXZOO8pWGf1v0pI+1dNaddU4f/7Mbv9P3EBwZDWS1Kbd6vtr3gwOY9u5 MiFA== X-Gm-Message-State: AO0yUKX4Y/SmAEGSiW3F4ZLLsDclE0ruGAaRhCSq4lAWZJ4LnMZ6dt7m qudbRk5ca+wlkjB+clzoru5qLA== X-Google-Smtp-Source: AK7set+T6NGS+8dLBFQbXc5KviKVoYqPgYbHtt4Fa+ii31MWbUlC+0tgTBmpM8q48+kVxUhmjMTwFQ== X-Received: by 2002:a5d:6906:0:b0:2c3:e7d8:245c with SMTP id t6-20020a5d6906000000b002c3e7d8245cmr1145326wru.13.1676817482798; Sun, 19 Feb 2023 06:38:02 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:02 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui Subject: [PATCH v1 07/17] thermal/hwmon: Use the thermal API instead tampering the internals Date: Sun, 19 Feb 2023 15:36:47 +0100 Message-Id: <20230219143657.241542-8-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In this function, there is a guarantee the thermal zone is registered. The sysfs hwmon unregistering will be blocked until we exit the function. The thermal zone is unregistered after the sysfs hwmon is unregistered. When we are in this function, the thermal zone is registered. We can call the thermal_zone_get_crit_temp() function safely and let the function use the lock which is private the thermal core code. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_hwmon.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmo= n.c index bc02095b314c..15158715b967 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -77,15 +77,7 @@ temp_crit_show(struct device *dev, struct device_attribu= te *attr, char *buf) int temperature; int ret; =20 - mutex_lock(&tz->lock); - - if (device_is_registered(&tz->device)) - ret =3D tz->ops->get_crit_temp(tz, &temperature); - else - ret =3D -ENODEV; - - mutex_unlock(&tz->lock); - + ret =3D thermal_zone_get_crit_temp(tz, &temperature); if (ret) return ret; =20 --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 8354EC74A44 for ; Sun, 19 Feb 2023 14:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229935AbjBSOjO (ORCPT ); Sun, 19 Feb 2023 09:39:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230196AbjBSOia (ORCPT ); Sun, 19 Feb 2023 09:38:30 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5084ADBFE for ; Sun, 19 Feb 2023 06:38:04 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id c17so334657wrx.0 for ; Sun, 19 Feb 2023 06:38:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R+m/EU1gXSm6WJAQH5g7filkNUzVF/bX1PoRwHbFLko=; b=VfYYkZ5TT/u3ZWOI3DwDBtkU4ce4agJCXU3Arhh4MdTVQZjY/nmlEDLM5bgbB43OrI f55PvFEfRJw2pck5/OeJCBh3jAnEeYQdX9AaNdVF1uNPaBwQ3brAINO9GBynjOdxBX4l rv36igFYqV3LFOfu+SN44+YKg3vOEhwfvr96D6SD92d4YpRa07EH5NEyzPCXIMmQxJP6 yAqu/7lVfUTXlixWDPB1FEnVJRvWli3KDCPziT32lNqwGF7JcygstYJ04zOxN+IDhfvR HcTdTlRCNxzrMqBa6uSlpjJ+lZJbzhke+SCHS5JoYdvUisdfG1QaaEEbUpzDGx3o1EWj OWEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R+m/EU1gXSm6WJAQH5g7filkNUzVF/bX1PoRwHbFLko=; b=Rjvgckq+/jq+yrw9QwN9eXZD1pyCNuA1MxzHPDt6oXJ1tKkdtZJUfksQS+LTaUd2++ pHcgHVPgI+0nocUEcA4P9WrStOg7RH285KjYoL+zkyjirWvETPLTdt9bMMoPiAGZtyf2 5+j3p7owvYffivUfnPMYe2i/AR6CZ+ZLeMkWdwVxc2fE+AmCGg5lFbbJvC6JcwAir/Tz 0NbpbyXDqZCeqQnEcV3uDacnibpCqpml9d1NBXDZIpo7o8sf/hSv+IAK5hqDLXG2evQy ulyksR0bgXJRloq1KhVXgz2LvtKjVASh98WhluDtta1XnGyqxGYtx++tRlQ4VQvrzclo KwxA== X-Gm-Message-State: AO0yUKU592HX8ABJpkkUYI8B+OTxTHpsswx53L2GOrLbpzzm1oJ+P7Xq fb0YRv8k5McaAR5os5tD+0el9Q== X-Google-Smtp-Source: AK7set+ygN2Mpl3h7e/m7umK62T/ytCPFqn8ymKKd5FxSgCG78soAg03RmQLoXiEfpb0tlmYAnxaBg== X-Received: by 2002:a5d:42d2:0:b0:2c5:7c26:c2cc with SMTP id t18-20020a5d42d2000000b002c57c26c2ccmr870419wrr.29.1676817483815; Sun, 19 Feb 2023 06:38:03 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:03 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui Subject: [PATCH v1 08/17] thermal/drivers/spear: Don't use tz->device but pdev->dev Date: Sun, 19 Feb 2023 15:36:48 +0100 Message-Id: <20230219143657.241542-9-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the spear associated device instead of the thermal zone device which belongs to the thermal framework internals. Signed-off-by: Daniel Lezcano --- drivers/thermal/spear_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_therma= l.c index 62cd9305eb9c..4598dedb82ec 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -137,7 +137,7 @@ static int spear_thermal_probe(struct platform_device *= pdev) =20 platform_set_drvdata(pdev, spear_thermal); =20 - dev_info(&spear_thermal->device, "Thermal Sensor Loaded at: 0x%p.\n", + dev_info(&pdev->dev, "Thermal Sensor Loaded at: 0x%p.\n", stdev->thermal_base); =20 return 0; --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 80784C6FD1B for ; Sun, 19 Feb 2023 14:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbjBSOjJ (ORCPT ); Sun, 19 Feb 2023 09:39:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230212AbjBSOic (ORCPT ); Sun, 19 Feb 2023 09:38:32 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6760DE07A for ; Sun, 19 Feb 2023 06:38:05 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id f12so575917wrr.4 for ; Sun, 19 Feb 2023 06:38:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QUidYE45QqwOhchUylILIXryDttVbD/LiMI/qWiuEu8=; b=KMWO2e3ra8asZTCibq/TH0eh7yyXfQ/YpoTRU80N0n+d0l1k2YieFdRnLov2a1lD+f pYGa1g8dRdYqeuE8QIphlV062WcX+/v7eVls9O6lwGYxNEGCfV4WV/NkBU6riCjti6Wn FvNQoVwUD/SaACi6sCZlaPerYy/dkGEaHqahaO9f7T4t8ABwoMNC3f1b4A1vvgcIdmXT 8qypKIkD250DbpW9hMnzb3QfgGNls2A9pR3Y7O2Ee9tFkQJ7iiC2zRlKDYNpp5RMF1bj t2Pnf8ABI8ongOk0YJb9VInvHZRUJA99Fe6Jml6lFyaOqupVdoVbPCxVSZPUb3U8XjGZ 2LtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QUidYE45QqwOhchUylILIXryDttVbD/LiMI/qWiuEu8=; b=3XpPkqVw6CFt/bB0BWY7d0Q3SNo1JeeGTWD3MDNSXphp2MlL7KYzTGeGyz5NwAMskY vAmCmWINImvwgdwVkpBaD4aOJoeARUj3BPdoof+Cg/2ESR2mDli8Wmj/DCM2ZHTDAPli fHQIjGBLMJrCrft3vZXsoH0bPMW8ZCOBiALPOnmq3VzvxJtM42+FUITiKDbLepr14cm9 1hvNJxQcNMPz4yYUFPnTWv4wQK/CqcWune6ejLXrGXggfmRa4b3gaOtqFXBEFx6CBU51 i2KrTYJk2AS8UI0cyw7LBwKEQW1ZhWXDEqSEllXcENO/8BaPDslzLWsoP82rjUYaFpuK Lvnw== X-Gm-Message-State: AO0yUKXSuvzENcs/ctv2hCVM5LqO/16atWawnmnOaCok55L/4pHeBXFf ZTJSAIoJfvry7qOvK2OiulxeZw== X-Google-Smtp-Source: AK7set9w+7iiWDGO75K4JsSY4vO06kP6rHS6Z9k1cw1W21gUqqD5eXplNGWx5/wK5+dYmg72sRyyVw== X-Received: by 2002:a5d:6b8e:0:b0:2bf:d333:219d with SMTP id n14-20020a5d6b8e000000b002bfd333219dmr1937123wrx.17.1676817484948; Sun, 19 Feb 2023 06:38:04 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:04 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jean Delvare , Guenter Roeck , Amit Kucheria , Zhang Rui , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v1 09/17] thermal: Add a thermal zone id accessor Date: Sun, 19 Feb 2023 15:36:49 +0100 Message-Id: <20230219143657.241542-10-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In order to get the thermal zone id but without directly accessing the thermal zone device structure, add an accessor. Use the accessor from the hwmon_scmi No functional change intented. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck --- drivers/hwmon/scmi-hwmon.c | 2 +- drivers/thermal/thermal_core.c | 6 ++++++ include/linux/thermal.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 7951b6026f48..036b56a535c1 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -220,7 +220,7 @@ static int scmi_thermal_sensor_register(struct device *= dev, sensor->name); } else { dev_dbg(dev, "Sensor '%s' attached to thermal zone ID:%d\n", - sensor->name, tzd->id); + sensor->name, thermal_zone_device_get_id(tzd)); } =20 return 0; diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 05e5a6bda695..e06c76b38c04 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1384,6 +1384,12 @@ void *thermal_zone_device_get_data(struct thermal_zo= ne_device *tzd) } EXPORT_SYMBOL_GPL(thermal_zone_device_get_data); =20 +int thermal_zone_device_get_id(struct thermal_zone_device *tzd) +{ + return tzd->id; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_get_id); + /** * thermal_zone_device_unregister - removes the registered thermal zone de= vice * @tz: the thermal zone device to remove diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 724b95662da9..9e5c7f2f7b05 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -367,6 +367,8 @@ thermal_zone_device_register_with_trips(const char *, s= truct thermal_trip *, int =20 void *thermal_zone_device_get_data(struct thermal_zone_device *tzd); =20 +int thermal_zone_device_get_id(struct thermal_zone_device *tzd); + int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, unsigned long, unsigned long, --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 AC45AC76188 for ; Sun, 19 Feb 2023 14:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230283AbjBSOjS (ORCPT ); Sun, 19 Feb 2023 09:39:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbjBSOif (ORCPT ); Sun, 19 Feb 2023 09:38:35 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ED84130 for ; Sun, 19 Feb 2023 06:38:11 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id c17so334788wrx.0 for ; Sun, 19 Feb 2023 06:38:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BDzCeDjhe5THr9kYy7urFayWf0fqGV769f7YqEQHSUI=; b=Z8AUw1H7XELv4lEQit2NEoHxzkJGSQ9zsP1UD7S8vitx8spwRUH0oFv8bdDtDUB7q2 SNRmLHoRxwEVKUl/VsrqK9RNCaH1gzMo9ynsfKIN7MspMhv2+OTXNw37ASDMyG5rXg2S E4Z8d+o6VcMFeBKRdCVTonKE+IY8nNVYPK2nknixLzkYkiwB0kOvd3pxmsL81HwsRRyQ FMb1mye/6YaO4vwnZKZHlVFKOf2bqSAxGetjMoXF4eR6pMEN9xUyRa8XwLBt76MGZ8Ix JC0hsXx6gJMOWvCqGmj33vrE4QmloGXxa3PKyoElUOscBWJHqe2D7w8dhVej9RVybn8O JXxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BDzCeDjhe5THr9kYy7urFayWf0fqGV769f7YqEQHSUI=; b=FqLWhdqN9ya3DrcYhOAjMiQaBuz6u4Hb9LP3Gs271+YI3PZzytc+G2CRgA0+ElfQ2Q LHKI2RA+KooXt8obJeFZwtsECZnwGKNYfbQbdmvfmO9dpfp7ey41oHbbg0bgrvFZmldV Byx4DTZ+SWqaTF2sf+pN0sl6nldk3FmhtueL4b1xkF0ZXeeqokDsw3GlHzm1hY/buqst 9zU3r5CVPxPTLa1KS5YJLUv6NyfTNdKyOlikp6fdYrN4EQ36c2jL0UymV3Wtvu/5x4Jm 0/n8IXx8OzsVcy205GCHHzO0P6aZT9LSMPBcPrVdue13rfpTR+vf2YMjipdKjdwpsRtr 0ilg== X-Gm-Message-State: AO0yUKVQQOzJo4sVtH79nwsiDrv8868iGjsEDfcO4C54otZtEiCk32kw s84SDjMuefJkH0f1Fj6WzgxMKw== X-Google-Smtp-Source: AK7set9gOvB2cw69asE5RVyB9RUwaoIIbKR7PwzhRSmLV9VgO/U1+dASYDHK4cogBEzlHi+x69Yx6A== X-Received: by 2002:adf:db01:0:b0:2c3:e07d:46cc with SMTP id s1-20020adfdb01000000b002c3e07d46ccmr1488574wri.41.1676817489911; Sun, 19 Feb 2023 06:38:09 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:09 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Rui , Len Brown , Ido Schimmel , Petr Machata , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Amit Kucheria , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno , Balsam CHIHI , linux-acpi@vger.kernel.org (open list:ACPI THERMAL DRIVER), netdev@vger.kernel.org (open list:MELLANOX ETHERNET SWITCH DRIVERS), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v1 10/17] thermal: Do not access 'type' field, use the tz id instead Date: Sun, 19 Feb 2023 15:36:50 +0100 Message-Id: <20230219143657.241542-11-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The 'type' field is used as a name in the message. However we can have multiple thermal zone with the same type. The information is not accurate. Moreover, the thermal zone device structure is directly accessed while we want to improve the self-encapsulation of the code. Replace the 'type' in the message by the thermal zone id. Signed-off-by: Daniel Lezcano Reviewed-by: Ido Schimmel --- drivers/acpi/thermal.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 4 ++-- drivers/thermal/mediatek/lvts_thermal.c | 5 +---- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 69d0da6456d5..4b5afaf843e2 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -842,7 +842,7 @@ static int acpi_thermal_register_thermal_zone(struct ac= pi_thermal *tz) goto acpi_bus_detach; =20 dev_info(&tz->device->dev, "registered as thermal_zone%d\n", - tz->thermal_zone->id); + thermal_zone_device_get_id(tz->thermal_zone)); =20 return 0; =20 diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/n= et/ethernet/mellanox/mlxsw/core_thermal.c index 228b6ffaef98..8dbb1c15b842 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -176,8 +176,8 @@ mlxsw_thermal_module_trips_update(struct device *dev, s= truct mlxsw_core *core, } =20 if (crit_temp > emerg_temp) { - dev_warn(dev, "%s : Critical threshold %d is above emergency threshold %= d\n", - tz->tzdev->type, crit_temp, emerg_temp); + dev_warn(dev, "tz id %d: Critical threshold %d is above emergency thresh= old %d\n", + thermal_zone_device_get_id(tz->tzdev), crit_temp, emerg_temp); return 0; } =20 diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/medi= atek/lvts_thermal.c index a65a81114cc5..90aab92a4185 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -304,10 +304,8 @@ static int lvts_set_trips(struct thermal_zone_device *= tz, int low, int high) * * 14-0 : Raw temperature for threshold */ - if (low !=3D -INT_MAX) { - pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, = low); + if (low !=3D -INT_MAX) writel(raw_low, LVTS_H2NTHRE(base)); - } =20 /* * Hot temperature threshold @@ -318,7 +316,6 @@ static int lvts_set_trips(struct thermal_zone_device *t= z, int low, int high) * * 14-0 : Raw temperature for threshold */ - pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, = high); writel(raw_high, LVTS_HTHRE(base)); =20 return 0; diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/t= hermal/ti-soc-thermal/ti-thermal-common.c index 8586cfe92df6..eda6d3af7b67 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -43,8 +43,8 @@ static void ti_thermal_work(struct work_struct *work) =20 thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); =20 - dev_dbg(data->bgp->dev, "updated thermal zone %s\n", - data->ti_thermal->type); + dev_dbg(data->bgp->dev, "updated thermal zone id %d\n", + thermal_zone_device_get_id(data->ti_thermal)); } =20 /** --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 CD39FC7618B for ; Sun, 19 Feb 2023 14:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230301AbjBSOjX (ORCPT ); Sun, 19 Feb 2023 09:39:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbjBSOif (ORCPT ); Sun, 19 Feb 2023 09:38:35 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D0610435 for ; Sun, 19 Feb 2023 06:38:11 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id e2so659245wri.12 for ; Sun, 19 Feb 2023 06:38:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5V8k85WBh6qZUpgkagLV5Wwa9BhBydDB+evx63M1T6s=; b=bz6mRp6L8imNt6G8MfRsQFKqwpjTgd6YSs/cluna39YPGVmTIdgoBMy37z+Kj74XUV L6aJni6CaRqQce2AWpIWOiPV+ogfkJs0gxtk/GWJbuIWONkS6zyRVcMwsBCtHLox4DXw 34Bpnc9ck+dXzdsjPRir+C2bCNN5k5IoY+0x5qMyMCV/WGh1Tx57DvsUJMhoDfOyy2OE aEON2ALmoJYZFJsSl+iE/3NdshfsL5bxIJwAyIgSo74O2gEo9PtvJtFcKPfKR21UaOno O88i9H0aJGVQhY8wEoOOyrgfdPF6fwMtniEDOeld84e9p5By8kpbZ6rZDjwxaPbOfZ8C h/rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5V8k85WBh6qZUpgkagLV5Wwa9BhBydDB+evx63M1T6s=; b=QuRWTLh61kbqBlSpcDJnzc5wuKV76/F1VWx3UVVfM+ic2tzCEbngrKt0FTXVKWx+Gx M7lKFwt5hCtzDpAYRapntqgfSgQFIw+t1Td/KS8mmZd+r/hXcwn57+8Mw8PUVJ3zjgE+ LVFj5q0j/0Omlur1/jNTVQ7O12/9H8+L+raJ5M5tXDxiI114dJdhOEasfq7LgZjdPYMq /fUYnMQGdK+3l6yD/9Mhxv0CKogw19qxRuutgYTRs9evXfkG7+8q5P+gR/flJHY7ERf7 RGtIFry+ScknzSbjA4OVWXn0C+JAMuO+LdALLyKOk3s1auFRDppDO5Yg516krkOFdDSs 2Tqg== X-Gm-Message-State: AO0yUKWTFFPm/W0ZopCY1UZ+UEEXFme9bAjHn7hRnvo0/XzjAJAJszAn msb2gFssAOgaS9kFiKlpsMWMLA== X-Google-Smtp-Source: AK7set8JspMichyJWLQwg7vvFIsYTvrkviPXxqtmKoI6Imvdjykv3GK8Dv9JGbmXxFoZ63vnOfHPzA== X-Received: by 2002:a05:6000:106:b0:2c5:889e:3c25 with SMTP id o6-20020a056000010600b002c5889e3c25mr320055wrx.3.1676817490907; Sun, 19 Feb 2023 06:38:10 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:10 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Support Opensource , Amit Kucheria , Zhang Rui Subject: [PATCH v1 11/17] thermal/drivers/da9062: Don't access the thermal zone device fields Date: Sun, 19 Feb 2023 15:36:51 +0100 Message-Id: <20230219143657.241542-12-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver is reading the passive polling rate in the thermal zone structure. We want to prevent the drivers to rummage around in the thermal zone structure. On the other side, the delay is what the driver passed to the thermal_zone_device_register() function, so it has already the information. Reuse the information we have instead of reading the information we set. Signed-off-by: Daniel Lezcano --- drivers/thermal/da9062-thermal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-ther= mal.c index 3d937f701e0b..2294938bb496 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -41,6 +41,8 @@ =20 #define DA9062_MILLI_CELSIUS(t) ((t) * 1000) =20 +static unsigned int pp_tmp =3D DA9062_DEFAULT_POLLING_MS_PERIOD; + struct da9062_thermal_config { const char *name; }; @@ -95,7 +97,10 @@ static void da9062_thermal_poll_on(struct work_struct *w= ork) thermal_zone_device_update(thermal->zone, THERMAL_EVENT_UNSPECIFIED); =20 - delay =3D thermal->zone->passive_delay_jiffies; + /* + * pp_tmp is between 1s and 10s, so we can round the jiffies + */ + delay =3D round_jiffies(msecs_to_jiffies(pp_tmp)); queue_delayed_work(system_freezable_wq, &thermal->work, delay); return; } @@ -155,7 +160,6 @@ static int da9062_thermal_probe(struct platform_device = *pdev) { struct da9062 *chip =3D dev_get_drvdata(pdev->dev.parent); struct da9062_thermal *thermal; - unsigned int pp_tmp =3D DA9062_DEFAULT_POLLING_MS_PERIOD; const struct of_device_id *match; int ret =3D 0; =20 @@ -208,8 +212,7 @@ static int da9062_thermal_probe(struct platform_device = *pdev) } =20 dev_dbg(&pdev->dev, - "TJUNC temperature polling period set at %d ms\n", - jiffies_to_msecs(thermal->zone->passive_delay_jiffies)); + "TJUNC temperature polling period set at %d ms\n", pp_tmp); =20 ret =3D platform_get_irq_byname(pdev, "THERMAL"); if (ret < 0) --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 DDA0FC7618A for ; Sun, 19 Feb 2023 14:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjBSOj0 (ORCPT ); Sun, 19 Feb 2023 09:39:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230248AbjBSOih (ORCPT ); Sun, 19 Feb 2023 09:38:37 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AD3810A82 for ; Sun, 19 Feb 2023 06:38:12 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id e2so659262wri.12 for ; Sun, 19 Feb 2023 06:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3o2qPN3/yYW8lF91ZCBRnsgBQhkI6h9wnRlSg/COMqw=; b=nIMl4jAbExXJgFyaCfJqOhgTWrmLu3C8v2CaRKcFnQIvN2CqE9VK5dWCRdt37ABDqU N78F3tB+/mOUmIvfWCU4DJf1/UgyOn+7sr4pLKu6hpHg4MNrUjbSVvu3PCLS04bLPQKN Gpl/jwQQD5skko7FPKT5ZyJV+trTpB7rAaI4wbVX8teLZIuVNpMHgxO9NLS3KHfDPDqA hDk+DVqv9Zg3ReQlOpLZtbb2Qbjt3KZKNrQFgfrWyL+U37qMVGWAsyf86/l3w0Q3riOY LMyaB2IQUseLY/hP8MhrusWNMDsBvEg3TjRc/OHmis9SolJ2oB2rgpZf5VQrVrXO+JAf aVew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3o2qPN3/yYW8lF91ZCBRnsgBQhkI6h9wnRlSg/COMqw=; b=RWDXdVreO0LdrtCU5Fi38TcHMd9YVICPHRHneGGYVKgA0bHcwqDu9Pq1lOxx7m5HrP 3Oz/ubQ6cJ70AB+n7GE+a1vRhH29EZZ6IzTEIOnQpkY/ylxvPDXF+1KDw71+dpW4Oi1R G21l4Qf4El4kwMcualvJ+r0r4UzafWg8yAQn5D3f9Cr6yFiMd8N/bs719H7Nles0hphr 0Q315FDuUpOgik7w5T51Txo5Hb59GqoBkhs7ghV7zAqMA1VXM00kIXc6cKGudHiOnEn7 /qLMdfnu/ghNGtcXGC4Jz8C521x6DnhIzEYyty1hbxEsbe9iuLqCtq9mTmjJNwC//1zz fJbw== X-Gm-Message-State: AO0yUKUFgIoa8OpxvkGyv6bS55nqmmuzyD/ul1nUS3VDeNu8YfGu1eL0 h9MARjck8SMlnYMEsAzbdYstfw== X-Google-Smtp-Source: AK7set+NvkQE4qL74JGUamf8KJhlCGSE06Lyjy/dgum0HQGWrelDK/Ibwr7TJ5POVxuaQ1ehKJxmKQ== X-Received: by 2002:a5d:4d89:0:b0:2c5:8ca5:58a3 with SMTP id b9-20020a5d4d89000000b002c58ca558a3mr91236wru.59.1676817491835; Sun, 19 Feb 2023 06:38:11 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:11 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui Subject: [PATCH v1 12/17] thermal/hwmon: Use the thermal_core.h header Date: Sun, 19 Feb 2023 15:36:52 +0100 Message-Id: <20230219143657.241542-13-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal_hwmon is playing with the thermal core code internals. Changing the code would be too invasive for now. We can consider the thermal_hwmon.c is part of the thermal core code as it provides a glue to tie the hwmon and the thermal zones. Let's include the thermal_core.h header. No functional change intended. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_hwmon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmo= n.c index 15158715b967..e1b9e95deade 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -17,6 +17,7 @@ #include =20 #include "thermal_hwmon.h" +#include "thermal_core.h" =20 /* hwmon sys I/F */ /* thermal zone devices with the same type share one hwmon device */ --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 ED66CC7618E for ; Sun, 19 Feb 2023 14:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbjBSOja (ORCPT ); Sun, 19 Feb 2023 09:39:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbjBSOih (ORCPT ); Sun, 19 Feb 2023 09:38:37 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15DF21115A for ; Sun, 19 Feb 2023 06:38:14 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id b10so388088wrx.11 for ; Sun, 19 Feb 2023 06:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xVzYorydu8I+vmR0UzViLt9Y2MhZrZxLWqtLEYveqhw=; b=aofmVeNA4acxVVgFs38ZTZRtGVg1wncseVSzDl5/8tQx4eux9fWRapy4cjcddqKUyj fSKV/ecXnrtBICF4qVNBzsCvINfrypeVjF9aCENYJbGpDzOYhGnyobwA9kXWxxOQACLG eIFdMAEjauS4L+ffvALgbZjl5wzOGCsySkz6XE8orKOTkdb/ciDEkS0E/wS5P/DyFruu VXmxTK+03qoIyIOpLLXfSsSgtZf/J+hrQ0KIr/9JiT7rVEZoTxdoyZNQR2kt1WXrTvhn HrAr4oKSfdr5CB4ulHVQFXWf/KX5kOQKdEIWklXPQgoQVSq2KH+AaTSr048RjW8Fdw3P yeLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xVzYorydu8I+vmR0UzViLt9Y2MhZrZxLWqtLEYveqhw=; b=pLIYvJ0E7mn44IuwyQHvQ0EOGQz5QzmhLAXbYN/7NuHws6/vg0Bsuo3ZOTLGARAJZC yFPWlgL7x2dqkV7WQXqy6ngissNetW0sGUFLdnJtXtf9D3Adtq3bSNm0EMCTRHzOPz9I ENfz6UbNNv1HRTNFvYtbpUcOV8j/zrMbh4DqVTGww4vTy31GrvZow7H6XMfGLpVhmGu4 462wcyJ8BL4L7dwAJZprRbjIrU/CdPLZCNgrhvBvv7QsWv/tp+gO5UhrGogS2DjwtWbr LfuubCS82wFU/GmnzUZl7lgM7kb5ZQDiwC8Z0aQaz9GJGfEXt0TSQaYjcArp4C86do4Z wPFg== X-Gm-Message-State: AO0yUKXL/x7G8BPAdlwuIjA2K+V9IV+dm6b5un4V6VNSEjTI+36Dpgy8 QiUh2bIuVLqnDUAgA4dd9WXkFQ== X-Google-Smtp-Source: AK7set9+IMytDQLX5f4z3vq8PuxTWU9aQeQD3QlYl1Tn6AoFc4WJCWv4N4Be9Np6y+/oDZjmFWXR3w== X-Received: by 2002:a05:6000:181:b0:2c5:49e1:b2cb with SMTP id p1-20020a056000018100b002c549e1b2cbmr1767154wrx.37.1676817493623; Sun, 19 Feb 2023 06:38:13 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:13 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Thierry Reding , Jonathan Hunter , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Florian Fainelli , Miquel Raynal , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v1 13/17] thermal/drivers/tegra: Remove unneeded lock when setting a trip point Date: Sun, 19 Feb 2023 15:36:53 +0100 Message-Id: <20230219143657.241542-14-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The function tegra_tsensor_enable_hw_channel() takes the thermal zone lock to prevent "a potential" race with a call to set_trips() callback. The driver must not play with the thermal framework core code internals. The tegra_tsensor_enable_hw_channel() is called by: - the suspend / resume callbacks - the probe function after the thermal zones are registered The thermal zone lock taken in this function is supposed to protect from a call to the set_trips() callback which writes in the same register. The potential race is when suspend / resume are called at the same time as set_trips. This one is called only in thermal_zone_device_update(). - At suspend time, the 'in_suspend' is set, thus the thermal_zone_device_update() bails out immediately and set_trips is not called during this moment. - At resume time, the thermal zone is updated at PM_POST_SUSPEND, thus the driver has already set the TH2 temperature. - At probe time, we register the thermal zone and then we set the TH2. The only scenario I can see so far is the interrupt fires, the thermal_zone_update() is called exactly at the moment tegra_tsensor_enable_hw_channel() a few lines after registering it. Disable the interrupt before setting up the hw channels and then enable it. We close the potential race window without using the thermal zone's lock. Signed-off-by: Daniel Lezcano --- drivers/thermal/tegra/tegra30-tsensor.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegr= a/tegra30-tsensor.c index ceb5b1b338a9..9cf74208673f 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -359,9 +359,6 @@ static int tegra_tsensor_enable_hw_channel(const struct= tegra_tsensor *ts, =20 tegra_tsensor_get_hw_channel_trips(tzd, &hot_trip, &crit_trip); =20 - /* prevent potential racing with tegra_tsensor_set_trips() */ - mutex_lock(&tzd->lock); - dev_info_once(ts->dev, "ch%u: PMC emergency shutdown trip set to %dC\n", id, DIV_ROUND_CLOSEST(crit_trip, 1000)); =20 @@ -404,8 +401,6 @@ static int tegra_tsensor_enable_hw_channel(const struct= tegra_tsensor *ts, val |=3D FIELD_PREP(TSENSOR_SENSOR0_CONFIG0_INTR_THERMAL_RST_EN, 1); writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG0); =20 - mutex_unlock(&tzd->lock); - err =3D thermal_zone_device_enable(tzd); if (err) { dev_err(ts->dev, "ch%u: failed to enable zone: %d\n", id, err); @@ -592,12 +587,24 @@ static int tegra_tsensor_probe(struct platform_device= *pdev) return dev_err_probe(&pdev->dev, err, "failed to request interrupt\n"); =20 + /* + * Disable the interrupt so set_trips() can not be called + * while we are setting up the register + * TSENSOR_SENSOR0_CONFIG1. With this we close a potential + * race window where we are setting up the TH2 and the + * temperature hits TH1 resulting to an update of the + * TSENSOR_SENSOR0_CONFIG1 register in the ISR. + */ + disable_irq(irq); + for (i =3D 0; i < ARRAY_SIZE(ts->ch); i++) { err =3D tegra_tsensor_enable_hw_channel(ts, i); if (err) return err; } =20 + enable_irq(irq); + return 0; } =20 --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 8A34EC61DA4 for ; Sun, 19 Feb 2023 14:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230328AbjBSOjc (ORCPT ); Sun, 19 Feb 2023 09:39:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbjBSOii (ORCPT ); Sun, 19 Feb 2023 09:38:38 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 076CD40EF for ; Sun, 19 Feb 2023 06:38:17 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id b11so1186947wrw.5 for ; Sun, 19 Feb 2023 06:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xv3bh2zC0J+7vpmzMRFSxk7m0hcCBp2b/iLCrIz7G/o=; b=XC5Wo9srbZi3yY8KorNxezRLSEpXC4giMo2mU6HA4cWHQzmU6Mu/pX2nRlaXvY32rI r262bNFNaJYMMTJWIsgu0+/LztOlolOYgAiazTl5Q//M15SR+cPxWdmBApPItFsDn5gE tfYp69rY5dF1gpHndpWm9vM7TJWEk0tc53FpDiS/NNuEfI5UJtHyXBZCHj8QZkChaMQm 6IOtva1EZTEAR2fenKoTKdoA8Vi2IAUnGdVc4Fdho3GzfcCQX2TKOA4dkkXuZvLtDBEl hdovEk8gFtd9x6eUR3Kf37LbjWs25nhk6pjj09W2LDpLUoYa+VCycduqo/4vmzrJHSiN fxoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xv3bh2zC0J+7vpmzMRFSxk7m0hcCBp2b/iLCrIz7G/o=; b=LouE0vXA2w4XrR6u/LKn3k95bH+r056s9hud9QI+zAWjI3zo734M+j6konZaJsKd03 wMcPYLO+/g8Y5fzOvyi4kBCw73HJGLskSd+WC2FI9B8P0c6i5CD+dwV/1KmcdnIjRhtl XrP7JLKxoxug0c7+Hu0wCN9R6AHdidKv6v0jadrguA5m6fIUCWkz85f4ikgAfJN9pdoh f5sJnarDxeZWBLn5GecObpX2QH+FfXfoN87I9Uk+GKBA7Wk9YpXfjgSghELfsyYYDaML y6P5chfJehCpCeSPyD4d354NVzasq8MoHvgnced+gUHIcwsrJHe+misGfVQlYtCjIya4 wPPA== X-Gm-Message-State: AO0yUKXgInDX1J4eqeNitCmvF3HziXtQGmCp7P8w5IUm/XYQBYaJBkWL dHDN9a5MxZkBsFG05wsYI/7msA== X-Google-Smtp-Source: AK7set8GWLf4JlCIofR3paOsNVIlWn9C52sC04eD1IEBdiF9wnaw+PcT9kVK6A7ritTiQV5JJm0y7Q== X-Received: by 2002:a5d:684f:0:b0:2c5:594b:10d1 with SMTP id o15-20020a5d684f000000b002c5594b10d1mr1454118wrw.23.1676817495488; Sun, 19 Feb 2023 06:38:15 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:15 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Thierry Reding , Jonathan Hunter , Neil Armstrong , Kunihiko Hayashi , Florian Fainelli , Miquel Raynal , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v1 14/17] thermal/tegra: Do not enable the thermal zone, it is already enabled Date: Sun, 19 Feb 2023 15:36:54 +0100 Message-Id: <20230219143657.241542-15-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The code enables the thermal zone after setting it up. But the thermal zone is already enabled by thermal_of_zone_register() function. Signed-off-by: Daniel Lezcano --- drivers/thermal/tegra/tegra30-tsensor.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegr= a/tegra30-tsensor.c index 9cf74208673f..5b87b83a00aa 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -346,7 +346,7 @@ static int tegra_tsensor_enable_hw_channel(const struct= tegra_tsensor *ts, { const struct tegra_tsensor_channel *tsc =3D &ts->ch[id]; struct thermal_zone_device *tzd =3D tsc->tzd; - int err, hot_trip =3D 0, crit_trip =3D 0; + int hot_trip =3D 0, crit_trip =3D 0; u32 val; =20 if (!tzd) { @@ -401,12 +401,6 @@ static int tegra_tsensor_enable_hw_channel(const struc= t tegra_tsensor *ts, val |=3D FIELD_PREP(TSENSOR_SENSOR0_CONFIG0_INTR_THERMAL_RST_EN, 1); writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG0); =20 - err =3D thermal_zone_device_enable(tzd); - if (err) { - dev_err(ts->dev, "ch%u: failed to enable zone: %d\n", id, err); - return err; - } - return 0; } =20 --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 EED50C64EC4 for ; Sun, 19 Feb 2023 14:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230317AbjBSOjn (ORCPT ); Sun, 19 Feb 2023 09:39:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbjBSOij (ORCPT ); Sun, 19 Feb 2023 09:38:39 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12D6946A5 for ; Sun, 19 Feb 2023 06:38:18 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id o18so573654wrw.1 for ; Sun, 19 Feb 2023 06:38:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hT0OFrc5BzA/EvvKaTBdDeJt/aCTGhUdeg6ktzHv2us=; b=sfwr9FAw99JPs2jgsRVuLndpE8yao9Kl+E/z7U0mtt0pP2wD2IO88tvDM316wqGWhU bOtdbmo6FuZElTFCkVycRnwUmdf4ah20jq0eL1sf/3WBmvAFbi2/ShUdbPUPupKNwlH7 DtQV0DPhDXMxxhggpMeDdWPhTaWIjd7+vtd/a5ko8mGoFoZ1GDgtQSozSm3RpQyPFhMD DuUmE3eZX4nzx1bu3urwLB8LPnbclLMZNDMlpdEJLtabwYjR2FNOfQGWKOlK4oF5mHWd U46QiQUoGN1d9JMBk+FmgjQY9n9uqv84+h9mvy6RR7cjaYif91wVlSrCddz1YUdlDHX8 zVgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hT0OFrc5BzA/EvvKaTBdDeJt/aCTGhUdeg6ktzHv2us=; b=X5axPQytaoNVlFrxyF5T/IYKRa8mIoUzgW4f0Xe+aEYM0vPx7KAaIMtrBhZpQgloRS fm8yJNz46izLN1EOi2VEbxxV1tTEexppJtVkxTpjDt1f9uH7IeVq8tZtIxY999sMMInp atPmMGBdV0bE2dI/JDya7p7/3TNMZdWAFhMvsmVjsjjCSAgh3kHItCvsfh1Klhljxv8E YUVioUTXUlJVyDO8GP1li/UpYjLBHjDs4zj2Wc9gzqGR0oe/fq5zGJPe8ND34XlBoQgr S8YgztShuFGqDltUa7p3yj2Ya7ISPu3nhfZeZgVzIXaZheD+MVsLBi3RfCGecQ+mch1Q YvIA== X-Gm-Message-State: AO0yUKWIcjyWlgkpguK/oYNFOvJqQhWfmPXhKSSgDJK9deN1ess4GjWp x29AttaaOPwSGIoBTwVAbwvwHw== X-Google-Smtp-Source: AK7set9g+Xv8475Uge2nzGCrlGdlaMCAyOgNN15o6NiNULAV3ygGhrWV1qTQ1r30QtA0D7O9N+C6iQ== X-Received: by 2002:a05:6000:1789:b0:2c6:825d:ed13 with SMTP id e9-20020a056000178900b002c6825ded13mr368030wrg.25.1676817496530; Sun, 19 Feb 2023 06:38:16 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:16 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Kaestle , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org (open list:ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER) Subject: [PATCH v1 15/17] thermal/drivers/acerhdf: Make interval setting only at module load time Date: Sun, 19 Feb 2023 15:36:55 +0100 Message-Id: <20230219143657.241542-16-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal zone device structure is in the process of being private to the thermal framework core code. This driver is directly accessing and changing the monitoring polling rate. After discussing with the maintainers of this driver, having the polling interval at module loading time is enough for their purpose. Change the code to take into account the interval when the module is loaded but restrict the permissions so the value can not be changed afterwards. Signed-off-by: Daniel Lezcano Acked-by: Peter Kaestle --- drivers/platform/x86/acerhdf.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 1956469c3457..61f1c3090867 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -79,7 +79,6 @@ static unsigned int list_supported; static unsigned int fanstate =3D ACERHDF_FAN_AUTO; static char force_bios[16]; static char force_product[16]; -static unsigned int prev_interval; static struct thermal_zone_device *thz_dev; static struct thermal_cooling_device *cl_dev; static struct platform_device *acerhdf_dev; @@ -346,20 +345,15 @@ static void acerhdf_check_param(struct thermal_zone_d= evice *thermal) trips[0].temperature =3D fanon; trips[0].hysteresis =3D fanon - fanoff; =20 - if (kernelmode && prev_interval !=3D interval) { + if (kernelmode) { if (interval > ACERHDF_MAX_INTERVAL) { pr_err("interval too high, set to %d\n", ACERHDF_MAX_INTERVAL); interval =3D ACERHDF_MAX_INTERVAL; } + if (verbose) pr_notice("interval changed to: %d\n", interval); - - if (thermal) - thermal->polling_delay_jiffies =3D - round_jiffies(msecs_to_jiffies(interval * 1000)); - - prev_interval =3D interval; } } =20 @@ -807,5 +801,5 @@ static const struct kernel_param_ops interval_ops =3D { .get =3D param_get_uint, }; =20 -module_param_cb(interval, &interval_ops, &interval, 0600); +module_param_cb(interval, &interval_ops, &interval, 0000); MODULE_PARM_DESC(interval, "Polling interval of temperature check"); --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 D46B9C64ED6 for ; Sun, 19 Feb 2023 14:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229903AbjBSOjk (ORCPT ); Sun, 19 Feb 2023 09:39:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbjBSOik (ORCPT ); Sun, 19 Feb 2023 09:38:40 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C9BD4C1C for ; Sun, 19 Feb 2023 06:38:19 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id g7so387411wrd.3 for ; Sun, 19 Feb 2023 06:38:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6cznqdx01/faUtAoqSoejbDua4FcHXQ+/pRuK304PkQ=; b=cBxhQu1MiOuL3c2L69272RQU7uQ6pCjBn1d6SnryOcPwzupn7ueF8v5MEdeVNvBhYS h4/TwVhfcN/MN9hlwB8QyTpNx+kdobugSn0/OhyFNEDgT7L7qRjm7Cd4yrhANU2OyGFV H1Qr5jUOIf0mZbTCAggAc4iJl9V8emZbfsBOze00UrhXGJ08aOO5AGUd+PT7QEfvz79i gjL7hSex7iEmPfKugolaqZ8XvolQH32Po+izM+zymyRhbarpF73Z//ViWIr/peUf/x9o JmHUGmsJT3ZvAFbajR3+xKxLS2GpaGjNTHYlrrha9gLDylB2mlXJOMZaHZIIyaTczr82 jyAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6cznqdx01/faUtAoqSoejbDua4FcHXQ+/pRuK304PkQ=; b=Mjhay5pw0cU87svCi1HAHGpRNXy0iu1fgL8BFvvq1KYBuW6NCp7lfTVG9zoVpi009T 7ihiN6JVuakcc58pJOdAZDvXNfyVfGn7U7x+QdbaVBKlW8zHoDYwxvZFDGYf5HaX0NDA Xc3uAb9tR80S7tOOLUmcL0IJRQ2ffgepUg/gvpxc7mkdOI5m0JasauWWwQVuHrg5/oaM u9qhJrQXv3X8s+gE7KnBem1zE6vaLXh1JqfS0vCSttm+G6Yu5LXycYo3q6kLPC+Jr6tD XFYBqPNHDDTCAwNeJGZGtnLI7Qvx5FwR9ApoB/8XuKltGF29txgvVOH+qjgZVUc6eaSw Xk2A== X-Gm-Message-State: AO0yUKUbGTX0xmNFV5fYmVkB2cqEOq6Sde59+sFAWcViE/KHgK/ecQyS +V7ucP8WO+kGtBwe6qBeDbs9aw== X-Google-Smtp-Source: AK7set+LnJkrxCtM/Mt4QXFkrHuNKO4fIAzFAlp1XOjSJ6bYXltoBh/a3YeqKMC6XlgtTD7NaFAy2g== X-Received: by 2002:a05:6000:1866:b0:2c4:669:fda4 with SMTP id d6-20020a056000186600b002c40669fda4mr642159wri.0.1676817497552; Sun, 19 Feb 2023 06:38:17 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:17 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Kaestle , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org (open list:ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER) Subject: [PATCH v1 16/17] thermal/drivers/acerhdf: Remove pointless governor test Date: Sun, 19 Feb 2023 15:36:56 +0100 Message-Id: <20230219143657.241542-17-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal zone parameter specifies the bang-bang governor. The Kconfig selects the bang-bang governor. So it is pointless to test if the governor was set for the thermal zone assuming it may not have been compiled-in. Remove the test and prevent another access into the thermal internals. Signed-off-by: Daniel Lezcano Acked-by: Peter Kaestle --- drivers/platform/x86/acerhdf.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 61f1c3090867..71b9c1f922d9 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -697,13 +697,6 @@ static int __init acerhdf_register_thermal(void) if (ret) return ret; =20 - if (strcmp(thz_dev->governor->name, - acerhdf_zone_params.governor_name)) { - pr_err("Didn't get thermal governor %s, perhaps not compiled into therma= l subsystem.\n", - acerhdf_zone_params.governor_name); - return -EINVAL; - } - return 0; } =20 --=20 2.34.1 From nobody Thu Nov 14 06:32:35 2024 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 BEA6EC05027 for ; Sun, 19 Feb 2023 14:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbjBSOjg (ORCPT ); Sun, 19 Feb 2023 09:39:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbjBSOil (ORCPT ); Sun, 19 Feb 2023 09:38:41 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A6D81117E for ; Sun, 19 Feb 2023 06:38:20 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id c17so335054wrx.0 for ; Sun, 19 Feb 2023 06:38:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uQDbrZzTyIu0DglbWKhFLaeyxSO75uKLoMfSjkuf9YI=; b=JmC/4sBikepuW2JL9s0EDARnxaYc9IhDcSSyd6fyTgOXblmVe2B7Cw4NdEaUve7mnf kOd6Nls86ri95KMu6WGE0bWwE2DHHdvx2fO4PaoebjorROd8/s0yz8rUdE97FQz4N1q/ WOYl+CLeNIpT/GfpXmGwr76XysM7kty0PsloJSBr4Vz/JRh+3oNv4nEzZTMUD5nPAKPU bMay40lxp632XH2jOvoakMsN6ai82/dY2oY8W3b11A794yUhGGNe4WNJJwi2i+mRBe2C YJUIUysF3CeGyMNpf3yk6QTIk4Ayt9ERqe28tXPFnM7rF+Vl0J7DGvTO9G6qnWCU2NNi IweQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uQDbrZzTyIu0DglbWKhFLaeyxSO75uKLoMfSjkuf9YI=; b=0jVMyftdAL5H6EkhK3YqRLE2m8T7ECB1d/z4QDCR2NsePf+6U+NeQ0sWY9cxAIMxEa P3qaKzfFq2VnXvgmr7aZKAuanRZB3bLoWPfpI841oQQAVgIE2QFtGyU9J4lAcJwgAGKE 5G2Mn3/xZbA9H3gGQhYM9mS2HuuHYkRnNk5szUoI1kygWj1M+2UcTLkPbhZGlOlCU3Kh 7indVdyp6nOjGVwslQkRZ1iV6RryOpIN1erDYaE4HvGzNv23MDTqk1NWZnHMb2cj6M6L qQmvUWfHJVhaBWnGYpGTyABui2TVhiM837WADWUUBTs+Ub3+oJ/jYfzd6FQF5eoUNMHV Xrhg== X-Gm-Message-State: AO0yUKWmOl20LBwFE+5lg0Vn2jb2yxm/YddRWI6JsiqOy1pxBQtm8Dzc NyhMoRtAE885TzihUXTHpNpkmA== X-Google-Smtp-Source: AK7set9FPJDzm1Vj7zrXvpQzx9aw3H/dbD9ad4OcovBUQOY/lXbpxGaorLf2uPObOVPYJr4I3dCEiA== X-Received: by 2002:a5d:6502:0:b0:2c6:85ef:3cd2 with SMTP id x2-20020a5d6502000000b002c685ef3cd2mr221046wru.33.1676817499495; Sun, 19 Feb 2023 06:38:19 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:19 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Lukasz Luba , Steven Rostedt , Masami Hiramatsu , Viresh Kumar , linux-trace-kernel@vger.kernel.org (open list:TRACING) Subject: [PATCH v1 17/17] thermal/traces: Replace the thermal zone structure parameter with the field value Date: Sun, 19 Feb 2023 15:36:57 +0100 Message-Id: <20230219143657.241542-18-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In the work of the thermal zone device self-encapsulation, let's pass the field value instead of dereferencing them in the traces which force us to export publicly the thermal_zone_device structure. No fonctionnal change intended. Signed-off-by: Daniel Lezcano --- drivers/thermal/gov_fair_share.c | 2 +- drivers/thermal/gov_power_allocator.c | 4 ++-- drivers/thermal/gov_step_wise.c | 2 +- drivers/thermal/thermal_core.c | 5 ++-- include/trace/events/thermal.h | 24 +++++++++---------- .../trace/events/thermal_power_allocator.h | 12 +++++----- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_sh= are.c index aad7d5fe3a14..e6c21abaaa80 100644 --- a/drivers/thermal/gov_fair_share.c +++ b/drivers/thermal/gov_fair_share.c @@ -35,7 +35,7 @@ static int get_trip_level(struct thermal_zone_device *tz) * point, in which case, trip_point =3D count - 1 */ if (count > 0) - trace_thermal_zone_trip(tz, count - 1, trip.type); + trace_thermal_zone_trip(tz->type, tz->id, count - 1, trip.type); =20 return count; } diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_po= wer_allocator.c index 0eaf1527d3e3..aaa8b57434ef 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -266,7 +266,7 @@ static u32 pid_controller(struct thermal_zone_device *t= z, =20 power_range =3D clamp(power_range, (s64)0, (s64)max_allocatable_power); =20 - trace_thermal_power_allocator_pid(tz, frac_to_int(err), + trace_thermal_power_allocator_pid(tz->id, frac_to_int(err), frac_to_int(params->err_integral), frac_to_int(p), frac_to_int(i), frac_to_int(d), power_range); @@ -481,7 +481,7 @@ static int allocate_power(struct thermal_zone_device *t= z, i++; } =20 - trace_thermal_power_allocator(tz, req_power, total_req_power, + trace_thermal_power_allocator(tz->id, req_power, total_req_power, granted_power, total_granted_power, num_actors, power_range, max_allocatable_power, tz->temperature, diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wis= e.c index 31235e169c5a..f469e04770fe 100644 --- a/drivers/thermal/gov_step_wise.c +++ b/drivers/thermal/gov_step_wise.c @@ -109,7 +109,7 @@ static void thermal_zone_trip_update(struct thermal_zon= e_device *tz, int trip_id =20 if (tz->temperature >=3D trip.temperature) { throttle =3D true; - trace_thermal_zone_trip(tz, trip_id, trip.type); + trace_thermal_zone_trip(tz->type, tz->id, trip_id, trip.type); } =20 dev_dbg(&tz->device, "Trip%d[type=3D%d,temp=3D%d]:trend=3D%d,throttle=3D%= d\n", diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index e06c76b38c04..0f6af8ab2f41 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -336,7 +336,7 @@ static void handle_critical_trips(struct thermal_zone_d= evice *tz, if (trip_temp <=3D 0 || tz->temperature < trip_temp) return; =20 - trace_thermal_zone_trip(tz, trip, trip_type); + trace_thermal_zone_trip(tz->type, tz->id, trip, trip_type); =20 if (trip_type =3D=3D THERMAL_TRIP_HOT && tz->ops->hot) tz->ops->hot(tz); @@ -387,7 +387,8 @@ static void update_temperature(struct thermal_zone_devi= ce *tz) tz->last_temperature =3D tz->temperature; tz->temperature =3D temp; =20 - trace_thermal_temperature(tz); + trace_thermal_temperature(tz->type, tz->id, + tz->last_temperature, tz->temperature); =20 thermal_genl_sampling_temp(tz->id, temp); } diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h index e58bf3072f32..50c7d2e1526d 100644 --- a/include/trace/events/thermal.h +++ b/include/trace/events/thermal.h @@ -23,22 +23,22 @@ TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE); =20 TRACE_EVENT(thermal_temperature, =20 - TP_PROTO(struct thermal_zone_device *tz), + TP_PROTO(const char *type, int id, int temp_prev, int temp), =20 - TP_ARGS(tz), + TP_ARGS(type, id, temp_prev, temp), =20 TP_STRUCT__entry( - __string(thermal_zone, tz->type) + __string(thermal_zone, type) __field(int, id) __field(int, temp_prev) __field(int, temp) ), =20 TP_fast_assign( - __assign_str(thermal_zone, tz->type); - __entry->id =3D tz->id; - __entry->temp_prev =3D tz->last_temperature; - __entry->temp =3D tz->temperature; + __assign_str(thermal_zone, type); + __entry->id =3D id; + __entry->temp_prev =3D temp_prev; + __entry->temp =3D temp; ), =20 TP_printk("thermal_zone=3D%s id=3D%d temp_prev=3D%d temp=3D%d", @@ -67,21 +67,21 @@ TRACE_EVENT(cdev_update, =20 TRACE_EVENT(thermal_zone_trip, =20 - TP_PROTO(struct thermal_zone_device *tz, int trip, + TP_PROTO(const char *type, int id, int trip, enum thermal_trip_type trip_type), =20 - TP_ARGS(tz, trip, trip_type), + TP_ARGS(type, id, trip, trip_type), =20 TP_STRUCT__entry( - __string(thermal_zone, tz->type) + __string(thermal_zone, type) __field(int, id) __field(int, trip) __field(enum thermal_trip_type, trip_type) ), =20 TP_fast_assign( - __assign_str(thermal_zone, tz->type); - __entry->id =3D tz->id; + __assign_str(thermal_zone, type); + __entry->id =3D id; __entry->trip =3D trip; __entry->trip_type =3D trip_type; ), diff --git a/include/trace/events/thermal_power_allocator.h b/include/trace= /events/thermal_power_allocator.h index 1c8fb95544f9..7ac049e7e3cf 100644 --- a/include/trace/events/thermal_power_allocator.h +++ b/include/trace/events/thermal_power_allocator.h @@ -8,12 +8,12 @@ #include =20 TRACE_EVENT(thermal_power_allocator, - TP_PROTO(struct thermal_zone_device *tz, u32 *req_power, + TP_PROTO(int id, u32 *req_power, u32 total_req_power, u32 *granted_power, u32 total_granted_power, size_t num_actors, u32 power_range, u32 max_allocatable_power, int current_temp, s32 delta_temp), - TP_ARGS(tz, req_power, total_req_power, granted_power, + TP_ARGS(id, req_power, total_req_power, granted_power, total_granted_power, num_actors, power_range, max_allocatable_power, current_temp, delta_temp), TP_STRUCT__entry( @@ -29,7 +29,7 @@ TRACE_EVENT(thermal_power_allocator, __field(s32, delta_temp ) ), TP_fast_assign( - __entry->tz_id =3D tz->id; + __entry->tz_id =3D id; memcpy(__get_dynamic_array(req_power), req_power, num_actors * sizeof(*req_power)); __entry->total_req_power =3D total_req_power; @@ -56,9 +56,9 @@ TRACE_EVENT(thermal_power_allocator, ); =20 TRACE_EVENT(thermal_power_allocator_pid, - TP_PROTO(struct thermal_zone_device *tz, s32 err, s32 err_integral, + TP_PROTO(int id, s32 err, s32 err_integral, s64 p, s64 i, s64 d, s32 output), - TP_ARGS(tz, err, err_integral, p, i, d, output), + TP_ARGS(id, err, err_integral, p, i, d, output), TP_STRUCT__entry( __field(int, tz_id ) __field(s32, err ) @@ -69,7 +69,7 @@ TRACE_EVENT(thermal_power_allocator_pid, __field(s32, output ) ), TP_fast_assign( - __entry->tz_id =3D tz->id; + __entry->tz_id =3D id; __entry->err =3D err; __entry->err_integral =3D err_integral; __entry->p =3D p; --=20 2.34.1