From nobody Thu Nov 14 06:29:54 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 6F56AC83003 for ; Tue, 28 Feb 2023 11:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231515AbjB1LXl (ORCPT ); Tue, 28 Feb 2023 06:23:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231526AbjB1LXc (ORCPT ); Tue, 28 Feb 2023 06:23:32 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A88C910255 for ; Tue, 28 Feb 2023 03:23:14 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id bw19so9295535wrb.13 for ; Tue, 28 Feb 2023 03:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583393; 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=msTNvGByW6wnSBM4h7Lzte8/9XtB6qDrvbyiJrlnYaU=; b=YKQQ0B6H86bZgv8j3DgnF2AtQJCvA145VIxwFfUEK7+OFSrQFhWn6Z+FO1FbzDXmc7 tezTe8SjarJXiAh5GSoO/UHL3lIQQiy8OJG6+CawvM4xwhUNtx2JfY3j+BXjgpXKNgUq J1R7rvUcw6nh5bFI7jvRn7uQ+jg1picGCFM9kKYmjU6lc9FhNrrZnbgNQ1WOJm4NLADv 8YXWAfgIq6fMhgj5pk91qyPgW+syl8emZPa8F+gi3vOP6+q/6m9Hxv9CREQlCwDq12KI je/vwDctD1L/a2PrLPlXQetXzCEMnbq7uyZMI390Yw7YRX6AUPulCVDwW0YaQrMCPz0V PjfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583393; 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=msTNvGByW6wnSBM4h7Lzte8/9XtB6qDrvbyiJrlnYaU=; b=Rftl2ZFEeKi9GgP3D0PvCKBHrsW14neaNH+ZtJPnWZDoeq1b6ISkoWBCCkJIaZSXoL 55nCSykEI9vvH6axNSH9/hUW/Yf9J9hsyUU73bCVEEov7Hu2aztl/IWyZ44rF30h7fvM gMEtKs7Hs34BT4VLewSFKLlLHmcq0eozw0NNnE3SeSOSChVqN8lps3x5DjkylzVYWmxV nFtabi441N87IcUV6hSKj8F4nv1LlhJC3ILe44tI1kIv3mUZJkaaXEfBmNu/tscJ4+IU TdWwa0KQZF8wSI+6LFNx3GpQJ90/NQd5SZokNIBYiKOAzGq7ezS0xUrES4RQrpfo5jHU mf+A== X-Gm-Message-State: AO0yUKVSmxovOPbDudHBF7E5klepQHw3JwTwqKov+asVaBNc4B6qklR3 MVZHah08fufiPMCxYPv2cidc0w== X-Google-Smtp-Source: AK7set/quQ4rSyRAWBNWHoRXbLJjh2dHPq5POGlwp84dvXvVg6gzdt7cUZwnJ86M3Kgacy5F2OUPAw== X-Received: by 2002:a5d:6d45:0:b0:2c7:851:c0bf with SMTP id k5-20020a5d6d45000000b002c70851c0bfmr1899592wri.0.1677583392984; Tue, 28 Feb 2023 03:23:12 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:12 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown , Ido Schimmel , Gregory Greenman , Sebastian Reichel , Damien Le Moal , "Rafael J . Wysocki" , Zhang Rui , Len Brown , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , 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 , Petr Machata , Kalle Valo , Sebastian Reichel , Liam Girdwood , 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-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)) Subject: [PATCH v4 04/19] thermal/core: Use the thermal zone 'devdata' accessor in remaining drivers Date: Tue, 28 Feb 2023 12:22:23 +0100 Message-Id: <20230228112238.2312273-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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. Use the devdata accessor introduced in the previous patch. No functional changes intended. Signed-off-by: Daniel Lezcano Acked-by: Mark Brown Reviewed-by: Ido Schimmel #mlxsw Acked-by: Gregory Greenman #iwlwifi Acked-by: Sebastian Reichel #power_supply Acked-by: Damien Le Moal #ahci Acked-by: Rafael J. Wysocki --- drivers/acpi/thermal.c | 16 ++++++++-------- drivers/ata/ahci_imx.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 +- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 0b4b844f9d4c..392b73b3e269 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_priv(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_priv(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_priv(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_priv(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_priv(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_priv(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_priv(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_priv(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..e45e91f5e703 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_priv(tz), temp); } =20 static ssize_t sata_ahci_show_temp(struct device *dev, diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpad= c-iio.c index a6ade70dedf8..a5322550c422 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_priv(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..1117fba30020 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_priv(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..dea9d2907666 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_priv(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..722e4a40afef 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_priv(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_priv(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_priv(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_priv(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_priv(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_priv(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_priv(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..354d95222b1b 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_priv(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_priv(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..83fd19079d8b 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_priv(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..303426135276 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_priv(tz); unsigned int val; int ret; =20 --=20 2.34.1