From nobody Thu Nov 14 07:04:05 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 4E1F4C7EE3A for ; Wed, 1 Mar 2023 20:15:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229899AbjCAUPw (ORCPT ); Wed, 1 Mar 2023 15:15:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbjCAUPs (ORCPT ); Wed, 1 Mar 2023 15:15:48 -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 0C8C94FA81 for ; Wed, 1 Mar 2023 12:15:23 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id ay29-20020a05600c1e1d00b003e9f4c2b623so297575wmb.3 for ; Wed, 01 Mar 2023 12:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701721; 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=ALPNa+Ht4A9WKChemeFuDH2Zm/x0B2Mij7U4LFqRVnGDFWxqeK0CII8+M9VfqWA++8 pUQ9WyF0igdKbje3hP3UA00qYYWjj1nJWidfJtZupkFJCmxznci/0sDgtUwZ9oZsilkM veSd1FCZ986QvGZTdigDBol3QdH12gxIA9G2xj3APMv5smBwtfcOqKMyJMCcy9wXUZ3Q kQEKMlVLoz5uJbHtn7Xrqyr5Yq3TzOfvaoAmaOoxx+4r5WtAMvvjt7znkwww89rnt2Bs 7YCbsYVXDleyjTXkxeFyIl0bk1MRlUS8EUWN0eo1TJaevGhuJEE4rangFoHm5v5Xbuua neKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701721; 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=Ylu13MW2SaY0qRHjhujs6DGg4YXT6J4zpkzOYZ4PzO8Qc4oF/zhvkFlalY1+plnUyu 6IkV4c+OFP23Y3NYFeofF9hI4U2/Y+D/ar6COS/kkY0MGksClUirdhHoX/FyKleF6p03 PC1VjUkSfc13Kwu7YrgtKmku6OYl9iQu+7QM/HbIJaCXm1aUQMgkSrribX8EKre9BM1p CD7gduX2rssCRmGJeQbQ9AjUiLQZsmcJCDFrfjE7B7H4DclksBL5R69S2hI2q/tgDPhU VWdhtuPh7BVLKtwjYZimCJBa5j1Gw0JbGpna9SPWTyOCkcq+yB5U2pqwS8lGf2Z3NgIh z6lQ== X-Gm-Message-State: AO0yUKWCwpmaN3nHjFCWSYjtyFaUpgtTYQhlktiwuQ+lftd0uKzI4TWr z0qBbc426TyzLc+ONE0UZHvr0Q== X-Google-Smtp-Source: AK7set8UnPJPqCopTlrX1h1ysdWfsbntVYzXC2vIceQe3cPlgnAA8BVHxvq5wELbCgVCcZJshXI9JA== X-Received: by 2002:a05:600c:3ac7:b0:3ea:f6c4:5f3f with SMTP id d7-20020a05600c3ac700b003eaf6c45f3fmr6173606wms.13.1677701721287; Wed, 01 Mar 2023 12:15:21 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6ffe:ce4f:bd31:1e6d]) by smtp.gmail.com with ESMTPSA id x16-20020a1c7c10000000b003e70a7c1b73sm576546wmc.16.2023.03.01.12.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:20 -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 v5 04/18] thermal/core: Use the thermal zone 'devdata' accessor in remaining drivers Date: Wed, 1 Mar 2023 21:14:32 +0100 Message-Id: <20230301201446.3713334-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301201446.3713334-1-daniel.lezcano@linaro.org> References: <20230301201446.3713334-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