From nobody Sat Sep 21 03:01:28 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 A2229C7EE30 for ; Wed, 1 Mar 2023 20:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbjCAUP0 (ORCPT ); Wed, 1 Mar 2023 15:15:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjCAUPF (ORCPT ); Wed, 1 Mar 2023 15:15:05 -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 CCF8442BC9 for ; Wed, 1 Mar 2023 12:14:58 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id e13so2979953wro.10 for ; Wed, 01 Mar 2023 12:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701697; 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=XAtw1U/BTDOrZHgBLIQAFfpKcmyk/l+MkBAEZzxdNlo=; b=LXar5EDJMGIvYkIQBNmH4aYD+L1S+thPtq/sVBh9BMX6eutE7uXqTCBu5XWNA4rH9k bxhZfiJgmSOli8WjZh6fThTr8fEDgRQf9ZabmpDx7qyVagf2vb/2lL8Ej0CCWueeUD28 rigW+wI0aZ8p41nZ4QFkUIe5I37Ls0U/f1nLDIIWWgvq8Ni7D20IuORr96GbR6MuAIpA 6bTbQS+c6tzTyyCgnJkYCxHzuDQ4SAMOjuAzo3BqTH5nKf9y5o+9PvyY3WF2sh6quRCK JpI3CrVtiHzTKhXZn8Sz167S6oHzcF796mz3pUfZNIjQjKigyPhttWKhnaBTakNeIx3v NAQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701697; 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=XAtw1U/BTDOrZHgBLIQAFfpKcmyk/l+MkBAEZzxdNlo=; b=xNG8OqF/1rTtR7WYeH4GemZyirRz32yd1tuObwqgXR5rcYG6pBcJJThnJqCPrV8Qfb EUIuDRyd7+XRhc4vcPL1XpJBZ/Q+VfW+QtuoTanF4p4mCymzzLqQuV2p9tN8p1ao1KUF BxtsbkPGydMUmpg1IkY5mYtYYq2UPkzmQgf0WvwaF82BxlhGSyfQcH15hJPm4r7UZjo9 yLwHweA34C05olNo5AHqIkeYzaFYlMY6S6CT30PaU2jwPnultBGxKxDuVmNX4X2DHr+S +XEl2P8QUVfT9CwTJz61fLbY6lKkIiL81wQAqvhkG2mD4Ec/DYUeShCGVPsxRrpckVyp A6nQ== X-Gm-Message-State: AO0yUKWudkK8v4rvPVN+XcCrnxK2tw4ZKmWzj9nEnhK3bkm2ELZe5prS k6kwCtqTBiSC6MdL/y8Mp0igqGE1cUPC7UyZmOE= X-Google-Smtp-Source: AK7set/YL6hJXKCT9Q1yd2tTfljiI6UDXAiLuLGRxiiD9DPPYB+Y8l3Q3UHRDiIWP4bV9wYn1zwkbQ== X-Received: by 2002:a5d:6607:0:b0:2bf:96ae:7cc8 with SMTP id n7-20020a5d6607000000b002bf96ae7cc8mr5920649wru.4.1677701696680; Wed, 01 Mar 2023 12:14:56 -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.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:14: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, "Rafael J . Wysocki" , Mark Brown , Amit Kucheria , Zhang Rui Subject: [PATCH v5 01/18] thermal/core: Add a thermal zone 'devdata' accessor Date: Wed, 1 Mar 2023 21:14:29 +0100 Message-Id: <20230301201446.3713334-2-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. 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: Rafael J. Wysocki Acked-by: Mark Brown --- drivers/thermal/thermal_core.c | 6 ++++++ include/linux/thermal.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 0675df54c8e6..9fa12147fead 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_priv(struct thermal_zone_device *tzd) +{ + return tzd->devdata; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_priv); + /** * 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 2bb4bf33f4f3..7dbb5712434c 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_priv(struct thermal_zone_device *tzd); + int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, unsigned long, unsigned long, @@ -436,6 +438,11 @@ static inline int thermal_zone_get_offset( struct thermal_zone_device *tz) { return -ENODEV; } =20 +static inline void *thermal_zone_device_priv(struct thermal_zone_device *t= z) +{ + return NULL; +} + static inline int thermal_zone_device_enable(struct thermal_zone_device *t= z) { return -ENODEV; } =20 --=20 2.34.1 From nobody Sat Sep 21 03:01:28 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 20B98C7EE39 for ; Wed, 1 Mar 2023 20:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbjCAUPi (ORCPT ); Wed, 1 Mar 2023 15:15:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbjCAUP3 (ORCPT ); Wed, 1 Mar 2023 15:15:29 -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 79600497F6 for ; Wed, 1 Mar 2023 12:15:18 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso343773wmb.0 for ; Wed, 01 Mar 2023 12:15:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701717; 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=0HjbdoBjX6c5UeLhSG1rbDyM1zgsqlgq1fI+l+tcxLM=; b=PZThdnWgYCnM5QXUT5KQw/HJDXu3kU8O0fC6EifT3rkN47u/7ud/jFm2qGlEg2cATp bf9xV8Yt4F76ICcpwuLl9c9lEdU1wufZhwg4dPSfxxlL4DM6fAh3tiGJi9VUjtvKiaBb 6Uf1Ph3jxB5ALc3LhUsf3yKCAJ+mhbkpqq0RpVw41ThwEzoyDqcHOdVQAkxXVZV0NLxy lcR82YvEPfu7UKzO8/pwWZwW2hOsVMYhzGZRhtIT7CwpMM5H8aW6l107MGHkYFLn4LUR 2hgAoQRKozTWGpfClJhlQCpULRvkUiirT2xPYFa0H9Pr4LB0MRh73Si5c6kI2Xiwskzo EuHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701717; 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=0HjbdoBjX6c5UeLhSG1rbDyM1zgsqlgq1fI+l+tcxLM=; b=o28IkTmVUnA4OAVxEmixo+zL6SDgCCZpRRuJyXSBNl7ymRbljqggDja91dIwA2RqCE xLW5XDYF1Q8C94SUbYVXcAEudQPziHBqbY4vfwSBDgawfss1lZ0EZ8n4N+UgOlNQ7zBB i7b5alhwmedjuwqyhppRqfe3Bivp70s8tUc24fpIbnMSubyAOISRt8Vq3VSBUZvJoHwU wP/yDobcn0egknuEEKmgYupKLycMdeLYqJfdyRmDoBJMeDlg/GCvEWUeKk2oJJCT/ZPA NOquJvlfsA8o66hsJxwgzBKTV+UseIMCX690+GETJzcElK+0p3GrcBRh2XZ5cdnavfye a9XA== X-Gm-Message-State: AO0yUKXP/k2uinIK/cVAL8CtWOYd9RNu9zBPCxmLKGXHgAmjyEksC0PP fGVYhxTT3tjSvKXT6LZUg/qNow== X-Google-Smtp-Source: AK7set/t7hT2+c9eutqwVC2JnnYWqL+Fl4wrXn9xFR1MX66CpVZungkpfz9/cNEycvs7GsCw7W5XfQ== X-Received: by 2002:a05:600c:a293:b0:3eb:3e24:59e2 with SMTP id hu19-20020a05600ca29300b003eb3e2459e2mr5845407wmb.25.1677701716503; Wed, 01 Mar 2023 12:15:16 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15: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, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Mark Brown , AngeloGioacchino Del Regno , Balsam CHIHI , Adam Ward , Baolin Wang , Jernej Skrabec , "Rafael J . Wysocki" , Florian Fainelli , Dhruva Gole , Guillaume La Roque , Amit Kucheria , Zhang Rui , Miquel Raynal , Broadcom internal kernel review list , Ray Jui , Scott Branden , Markus Mayer , Support Opensource , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Heiko Stuebner , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Orson Zhai , Chunyan Zhang , Maxime Coquelin , Alexandre Torgue , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Samuel Holland , Thierry Reding , Jonathan Hunter , Talel Shenhar , Eduardo Valentin , Keerthy , Kunihiko Hayashi , Masami Hiramatsu , Matthias Brugger , Stefan Wahren , Neil Armstrong , ye xingchen , Zheng Yongjun , Srinivas Pandruvada , Davidlohr Bueso , Sumeet Pawnikar , "Lee, Chun-Yi" , Shang XiaoJing , Tim Zimmermann , Yang Li , Jiang Jian , Daniel Golle , Randy Dunlap , Ido Schimmel , Minghao Chi , Johan Hovold , Mikko Perttunen , linux-amlogic@lists.infradead.org (open list:THERMAL DRIVER FOR AMLOGIC SOCS), 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-arm-msm@vger.kernel.org (open list:QUALCOMM TSENS THERMAL DRIVER), 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-stm32@st-md-mailman.stormreply.com (moderated list:ARM/STM32 ARCHITECTURE), 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 v5 02/18] thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers Date: Wed, 1 Mar 2023 21:14:30 +0100 Message-Id: <20230301201446.3713334-3-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Niklas S=C3=B6derlund = #R-Car Acked-by: Mark Brown Reviewed-by: AngeloGioacchino Del Regno #MediaTek auxadc and lvts Reviewed-by: Balsam CHIHI #Mediatek lvts Reviewed-by: Adam Ward #da9062 Reviewed-by: Baolin Wang #spread Acked-by: Jernej Skrabec #sun8i_thermal Acked-by: Rafael J. Wysocki Acked-by: Florian Fainelli #Broadcom Reviewed-by: Dhruva Gole # K3 bandgap Acked-by: Heiko Stuebner #rockchip Acked-by: Linus Walleij Reviewed-by: Kunihiko Hayashi #uniphier --- drivers/thermal/amlogic_thermal.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/db8500_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 +++--- .../thermal/intel/int340x_thermal/int3400_thermal.c | 2 +- .../intel/int340x_thermal/int340x_thermal_zone.c | 4 ++-- .../int340x_thermal/processor_thermal_device_pci.c | 4 ++-- drivers/thermal/intel/intel_pch_thermal.c | 2 +- drivers/thermal/intel/intel_quark_dts_thermal.c | 6 +++--- drivers/thermal/intel/intel_soc_dts_iosf.c | 13 +++++-------- drivers/thermal/intel/x86_pkg_temp_thermal.c | 4 ++-- drivers/thermal/k3_bandgap.c | 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/qcom/tsens.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/st/st_thermal.c | 2 +- drivers/thermal/st/stm_thermal.c | 4 ++-- drivers/thermal/sun8i_thermal.c | 2 +- drivers/thermal/tegra/soctherm.c | 6 +++--- 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_mmio.c | 2 +- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 4 ++-- drivers/thermal/uniphier_thermal.c | 2 +- 48 files changed, 79 insertions(+), 81 deletions(-) diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_th= ermal.c index 9235fda4ec1e..dfcc93e45cdd 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -181,7 +181,7 @@ static int amlogic_thermal_disable(struct amlogic_therm= al *data) static int amlogic_thermal_get_temp(struct thermal_zone_device *tz, int *t= emp) { unsigned int tval; - struct amlogic_thermal *pdata =3D tz->devdata; + struct amlogic_thermal *pdata =3D thermal_zone_device_priv(tz); =20 if (!pdata) return -EINVAL; diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_ther= mal.c index 2efc222a379b..ebd606861a61 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_priv(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_priv(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..fcfcbbf044a4 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_priv(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..86aaf459de37 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_priv(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..60173cc83c46 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_priv(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_priv(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..d255aa879fc0 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_priv(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..747915890022 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_priv(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..e7097f354750 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_priv(z); =20 mutex_lock(&thermal->lock); *temp =3D thermal->temperature; diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_ther= mal.c index cb10e280681f..c0418497520c 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -60,7 +60,7 @@ struct db8500_thermal_zone { /* Callback to get current temperature */ static int db8500_thermal_get_temp(struct thermal_zone_device *tz, int *te= mp) { - struct db8500_thermal_zone *th =3D tz->devdata; + struct db8500_thermal_zone *th =3D thermal_zone_device_priv(tz); =20 /* * TODO: There is no PRCMU interface to get temperature data currently, diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 056622a58d00..6db1882e8229 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_priv(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..f3a374266fa0 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_priv(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..efa1a4ffc368 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_priv(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..ddde4bdfc94a 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_priv(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..a22b8086a209 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_priv(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_priv(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_priv(tz); int ret; =20 ret =3D pm_runtime_resume_and_get(data->dev); diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/driv= ers/thermal/intel/int340x_thermal/int3400_thermal.c index d0295123cc3e..810231b59dcd 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -497,7 +497,7 @@ static int int3400_thermal_get_temp(struct thermal_zone= _device *thermal, static int int3400_thermal_change_mode(struct thermal_zone_device *thermal, enum thermal_device_mode mode) { - struct int3400_thermal_priv *priv =3D thermal->devdata; + struct int3400_thermal_priv *priv =3D thermal_zone_device_priv(thermal); int result =3D 0; =20 if (!priv) diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b= /drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c index 00665967ca52..89cf007146ea 100644 --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -14,7 +14,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, int *temp) { - struct int34x_thermal_zone *d =3D zone->devdata; + struct int34x_thermal_zone *d =3D thermal_zone_device_priv(zone); unsigned long long tmp; acpi_status status; =20 @@ -41,7 +41,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_z= one_device *zone, static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, int trip, int temp) { - struct int34x_thermal_zone *d =3D zone->devdata; + struct int34x_thermal_zone *d =3D thermal_zone_device_priv(zone); char name[] =3D {'P', 'A', 'T', '0' + trip, '\0'}; acpi_status status; =20 diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device= _pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci= .c index 40725cbc6eb0..0404d4db70f0 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -135,7 +135,7 @@ static irqreturn_t proc_thermal_irq_handler(int irq, vo= id *devid) =20 static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) { - struct proc_thermal_pci *pci_info =3D tzd->devdata; + struct proc_thermal_pci *pci_info =3D thermal_zone_device_priv(tzd); u32 _temp; =20 proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_PKG_TEMP, &_temp); @@ -146,7 +146,7 @@ static int sys_get_curr_temp(struct thermal_zone_device= *tzd, int *temp) =20 static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, in= t temp) { - struct proc_thermal_pci *pci_info =3D tzd->devdata; + struct proc_thermal_pci *pci_info =3D thermal_zone_device_priv(tzd); int tjmax, _temp; =20 if (temp <=3D 0) { diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/in= tel/intel_pch_thermal.c index b855d031a855..dce50d239357 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_priv(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_quark_dts_thermal.c b/drivers/ther= mal/intel/intel_quark_dts_thermal.c index 97b843fa7568..63569185ed82 100644 --- a/drivers/thermal/intel/intel_quark_dts_thermal.c +++ b/drivers/thermal/intel/intel_quark_dts_thermal.c @@ -120,7 +120,7 @@ static DEFINE_MUTEX(dts_update_mutex); static int soc_dts_enable(struct thermal_zone_device *tzd) { u32 out; - struct soc_sensor_entry *aux_entry =3D tzd->devdata; + struct soc_sensor_entry *aux_entry =3D thermal_zone_device_priv(tzd); int ret; =20 ret =3D iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, @@ -148,7 +148,7 @@ static int soc_dts_enable(struct thermal_zone_device *t= zd) static int soc_dts_disable(struct thermal_zone_device *tzd) { u32 out; - struct soc_sensor_entry *aux_entry =3D tzd->devdata; + struct soc_sensor_entry *aux_entry =3D thermal_zone_device_priv(tzd); int ret; =20 ret =3D iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, @@ -250,7 +250,7 @@ static int update_trip_temp(struct soc_sensor_entry *au= x_entry, static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int t= rip, int temp) { - return update_trip_temp(tzd->devdata, trip, temp); + return update_trip_temp(thermal_zone_device_priv(tzd), trip, temp); } =20 static int sys_get_curr_temp(struct thermal_zone_device *tzd, diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/i= ntel/intel_soc_dts_iosf.c index 8c26f7b2316b..f99dc7e4ae89 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_priv(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_priv(tzd); 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_priv(tzd); =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_priv(tzd); 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..c4ec314441be 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_priv(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_priv(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..b5cd2c85e0c3 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_priv(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..5be1f09eeb2c 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_priv(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..92b3ce426b9d 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_priv(thermal); =20 reg =3D readl_relaxed(priv->sensor); =20 diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_= thermal.c index 6451a55eb582..bf1679765f1b 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_priv(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..755baa4e5bd2 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_priv(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..fb4b1b4db245 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_priv(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_priv(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..ed204489a950 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_priv(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_priv(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..b196d8d01726 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_priv(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_priv(tz); struct thermal_trip trip; int ret; =20 diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 8020ead2794e..6cc935379f00 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -673,7 +673,7 @@ static irqreturn_t tsens_combined_irq_thread(int irq, v= oid *data) =20 static int tsens_set_trips(struct thermal_zone_device *tz, int low, int hi= gh) { - struct tsens_sensor *s =3D tz->devdata; + struct tsens_sensor *s =3D thermal_zone_device_priv(tz); struct tsens_priv *priv =3D s->priv; struct device *dev =3D priv->dev; struct tsens_irq_data d; @@ -1057,7 +1057,7 @@ int __init init_common(struct tsens_priv *priv) =20 static int tsens_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsens_sensor *s =3D tz->devdata; + struct tsens_sensor *s =3D thermal_zone_device_priv(tz); struct tsens_priv *priv =3D s->priv; =20 return priv->ops->get_temp(s, temp); diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_therma= l.c index 431c29c0898a..d2dc99247f61 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_priv(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..2b7537ef141d 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_priv(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_priv(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..e0440f63ae77 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_priv(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..8a51eb26e798 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_priv(tz); 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_priv(tz); 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..7631430ce8a9 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_priv(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..45e5c840d130 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_priv(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_priv(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..653439b965c8 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_priv(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_priv(spear_therma= l); 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_priv(spear_therma= l); 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_priv(spear_therma= l); =20 thermal_zone_device_unregister(spear_thermal); =20 diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index ac884514f116..2fb90fdad76e 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_priv(tz); u32 data; =20 data =3D readl(sen->data->base + SPRD_THM_TEMP(sen->id)) & diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_therma= l.c index 1009f08e64e3..6ed393218eb8 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -108,7 +108,7 @@ static int st_thermal_calibration(struct st_thermal_sen= sor *sensor) /* Callback to get temperature from HW*/ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temper= ature) { - struct st_thermal_sensor *sensor =3D th->devdata; + struct st_thermal_sensor *sensor =3D thermal_zone_device_priv(th); struct device *dev =3D sensor->dev; unsigned int temp; unsigned int overflow; diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_ther= mal.c index 735401958f01..6f2bad8ef82f 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -303,7 +303,7 @@ static int stm_disable_irq(struct stm_thermal_sensor *s= ensor) =20 static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, = int high) { - struct stm_thermal_sensor *sensor =3D tz->devdata; + struct stm_thermal_sensor *sensor =3D thermal_zone_device_priv(tz); u32 itr1, th; int ret; =20 @@ -351,7 +351,7 @@ static int stm_thermal_set_trips(struct thermal_zone_de= vice *tz, int low, int hi /* Callback to get temperature from HW */ static int stm_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct stm_thermal_sensor *sensor =3D tz->devdata; + struct stm_thermal_sensor *sensor =3D thermal_zone_device_priv(tz); u32 periods; int freqM, ret; =20 diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_therma= l.c index 497beac63e5d..6b550f0f90bf 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_priv(tz); struct ths_device *tmdev =3D s->tmdev; int val =3D 0; =20 diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/socth= erm.c index 220873298d77..ea66cba09e56 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -423,7 +423,7 @@ static int translate_temp(u16 val) =20 static int tegra_thermctl_get_temp(struct thermal_zone_device *tz, int *ou= t_temp) { - struct tegra_thermctl_zone *zone =3D tz->devdata; + struct tegra_thermctl_zone *zone =3D thermal_zone_device_priv(tz); u32 val; =20 val =3D readl(zone->reg); @@ -584,7 +584,7 @@ static int tsensor_group_thermtrip_get(struct tegra_soc= therm *ts, int id) =20 static int tegra_thermctl_set_trip_temp(struct thermal_zone_device *tz, in= t trip_id, int temp) { - struct tegra_thermctl_zone *zone =3D tz->devdata; + struct tegra_thermctl_zone *zone =3D thermal_zone_device_priv(tz); struct tegra_soctherm *ts =3D zone->ts; struct thermal_trip trip; const struct tegra_tsensor_group *sg =3D zone->sg; @@ -658,7 +658,7 @@ static void thermal_irq_disable(struct tegra_thermctl_z= one *zn) =20 static int tegra_thermctl_set_trips(struct thermal_zone_device *tz, int lo= , int hi) { - struct tegra_thermctl_zone *zone =3D tz->devdata; + struct tegra_thermctl_zone *zone =3D thermal_zone_device_priv(tz); u32 r; =20 thermal_irq_disable(zone); diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/t= egra/tegra-bpmp-thermal.c index 0b7a1a1948cb..7bd8ea770fa1 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_priv(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_priv(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..42c6fb494dd9 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_priv(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_priv(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..2c283e762d81 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_priv(tz); int val; int ret; =20 diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c index ea616731066c..6845756ad5e7 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_priv(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..3e998c9799bb 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_priv(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_priv(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..aef6119cc004 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_priv(tz); struct regmap *map =3D tdev->regmap; int ret; u32 temp; --=20 2.34.1 From nobody Sat Sep 21 03:01:28 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 C7F73C678D4 for ; Wed, 1 Mar 2023 20:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229463AbjCAUPn (ORCPT ); Wed, 1 Mar 2023 15:15:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229899AbjCAUPe (ORCPT ); Wed, 1 Mar 2023 15:15:34 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60552498B1 for ; Wed, 1 Mar 2023 12:15:19 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id p16so9365715wmq.5 for ; Wed, 01 Mar 2023 12:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701717; 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=664mQufj36GAinUsmDVRemqvXpqdvf+x4ah+LNp4umE=; b=OnyIPByHTPA/VbLfXLKicS18pAva9yatk1gSb93dvKbk30+4FKD4PiBW8V5G7P1VeI R+aGFczeEJakPBik63P/hJzQTMhjrfRfKXkn6IBQAytAGaE9zkexehWVA4yF8Gk8Bqk8 uXQgFo0hzCKNRoDrePlEeFMbbUHS5Q5+MKrREJqbcvzJlWv6HrruCUau3llsqn1bzer0 SuHuDplcwINLb3QmdleFHbKVsA+V1Ao3hYefevttxEeR8WsszZbzMskxG5rIIwSo3IW1 j6ueXZJ+JYH9zwt5arjeojhZ2vGdYvaNtYI1ptE5zBu1Hc9TB6OOcOgrxNwxV0+t4zxR VEFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701717; 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=664mQufj36GAinUsmDVRemqvXpqdvf+x4ah+LNp4umE=; b=ofFTerHaoHx6VusyjUhw+oE3YzFj/g5Cz0DqE7cwX9vVzR1vRYs6zfpdMwm9aMK2t6 QrTPjbZ3ix2IQad3BpGCXDtNlpdZ7WNF4Pn0FGwjeQBY1C0D8vPrtJHVMiiPy5LKPfjE +06ZmSC0AXfnhgTJGcesB9f5XMWWGvbmwye+t8DiEKFAnvZW0bu5ptA7AMzVylUNJM7j Xsk9BHexwB95445E6tNjStpa06LaHOJRUFOBana5bbnSxbwG2NdK6MQpbQsD1FLpYT1C KFa2hXDNujY1cseZHdTIboao+75Ycz96xCPmG61yiLOMC+arp//GZU1Tfq/PfUWlHyb1 iWPA== X-Gm-Message-State: AO0yUKXFFSeqYov7usOQpBh/IHXlfw2hOxNtAyW8fAnGswZ2A9S2Uiqb +S+0Qto5b5U+/AgMyzJzud9MR6IIaSXETbogiK8= X-Google-Smtp-Source: AK7set/bQpcBqUspIQrTUO5Lai+QN66xJeYQ1TdGWga6/epJ+Kk7g/iwrG6/S/zqyfzNWZ9wxbj2jA== X-Received: by 2002:a05:600c:70a:b0:3eb:2b79:a40 with SMTP id i10-20020a05600c070a00b003eb2b790a40mr5999178wmn.20.1677701717666; Wed, 01 Mar 2023 12:15:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15: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, Guenter Roeck , Mark Brown , "Rafael J . Wysocki" , Jean Delvare , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v5 03/18] thermal/core: Use the thermal zone 'devdata' accessor in hwmon located drivers Date: Wed, 1 Mar 2023 21:14:31 +0100 Message-Id: <20230301201446.3713334-4-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: Guenter Roeck #hwmon Acked-by: Mark Brown Acked-by: Rafael J. Wysocki --- drivers/hwmon/hwmon.c | 4 ++-- drivers/hwmon/pmbus/pmbus_core.c | 2 +- drivers/hwmon/scmi-hwmon.c | 2 +- drivers/hwmon/scpi-hwmon.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 33edb5c02f7d..3adf5c3c75ed 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_priv(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_priv(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..e39a327ac2a1 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_priv(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..046ac157749d 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_priv(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..121e5e9f487f 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_priv(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]; --=20 2.34.1 From nobody Sat Sep 21 03:01:28 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 From nobody Sat Sep 21 03:01:28 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 48C19C7EE23 for ; Wed, 1 Mar 2023 20:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229955AbjCAUP6 (ORCPT ); Wed, 1 Mar 2023 15:15:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbjCAUPt (ORCPT ); Wed, 1 Mar 2023 15:15:49 -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 1AC634FA95 for ; Wed, 1 Mar 2023 12:15:24 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id j3so9385225wms.2 for ; Wed, 01 Mar 2023 12:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701722; 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=8cRPoTQKkI6Vh2gx5bELOPsRnRzqaEtxSxLlrGiyoRc=; b=B9YthekpD/U0uo1LELMgmU9WPP8G5c3n+EBiyqdmY3mk1OC75xMx8/nWrc+X4CeaKT eTEAKeqJV1F1qSmqX2mp3ZMQXxiT+WuKC9GmXLQpD5lAk3w9k6uv4V5uR5vPl7Ezezyy cqgtBSaMDBt2gkXyyD4DqGXSDiIlonOW31JvRyZHYuirC+vI1hCoI2ceNEt8TB/BN8fE e5W/zGKb9GoJJdI7i9LkoaaYIlm+lv7pFhKsiPf7oPtfpxm/qh/fZX8hzXpN3hIqPXl+ DW9AL4tneBchL5RI2iOow/OC78JrfS3Ot+GJzDdIjQJDXWnGCD1FgXf2ZYUS7gqGk/4f ll+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701722; 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=8cRPoTQKkI6Vh2gx5bELOPsRnRzqaEtxSxLlrGiyoRc=; b=ykaLc+NeSxLGRhN5hnuM6UXCgQdVgd6+uoc9A14ylbwWzsip5SGFBO9gF8CL3uoAJU suM31yudImipOHq+lR+EHzins8nYngaa+54/n6rWwoZ1uz5Du3dcZToZtVQ/m7AaK/CV R6cffhLnYrrF9gUSmJE/ibsMExv3NU54pyQERonI03Jw1LALsduluL0hrDO80f6cJrKV Xu9flYfSnKL9PA6dgi4Mm1ajV5qIhIHMq03EYwFWvG0RTFxwRmvyMDqfg/ySKm+mHH2n C6C1IW7EnekdjYOCnIKiMf3BbDFjStKA8/qnc900TU9k2/zOwbTxqTszIB5ulPZUmkc+ 3L+g== X-Gm-Message-State: AO0yUKUgZe20Z2SLDH4EMJWqqSeDKgzPA00Zr+QYRBf5bgq0miZmFYee bB2TNhKx9JSXNDsJvX8KpQHc6w== X-Google-Smtp-Source: AK7set+HdHx1G17g16Uvtj4f41o8F9DUAsXLhvcMOvrAmf4/8g8enUQydKM/hxhsqf3fJ1Gzb3KWQA== X-Received: by 2002:a05:600c:a29d:b0:3dc:55d9:ec8 with SMTP id hu29-20020a05600ca29d00b003dc55d90ec8mr5713971wmb.41.1677701722390; Wed, 01 Mar 2023 12:15:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:21 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J . Wysocki" , Amit Kucheria , Zhang Rui Subject: [PATCH v5 05/18] thermal/core: Show a debug message when get_temp() fails Date: Wed, 1 Mar 2023 21:14:33 +0100 Message-Id: <20230301201446.3713334-6-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 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 Acked-by: Rafael J. Wysocki --- 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 Sat Sep 21 03:01:28 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 39AF7C7EE30 for ; Wed, 1 Mar 2023 20:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjCAUQC (ORCPT ); Wed, 1 Mar 2023 15:16:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229919AbjCAUPt (ORCPT ); Wed, 1 Mar 2023 15:15:49 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D52333455 for ; Wed, 1 Mar 2023 12:15:26 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id p26so9365933wmc.4 for ; Wed, 01 Mar 2023 12:15:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701725; 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=QZORbJEC0KXh3smLya7JMCOQlYUfz0b2RxRCc6FiOfI=; b=w2UyotQBOPnPIAhlCOUiER9zhQqCH46TqU0CF9HwS7QbTpIYPzAjo739J6E6Y4Xbbr 3GkHyyQede5+mr7z6WWDVYr/j2LDgBfKIoZeYOFBrx/tdh93aSfoo82Pm2chHsXNTAQg mEn2oHoSXhE1nUX1R7xwSKWGrDQZgsaG7luLmFFkXlIjBwJddYTdTA8ECkDhyAxbGWe0 ZYpLeF9ng699Gt1Qw7xB4W+O+hI42kY2PRizitbmBnwKG/REk9RwrvWRUhycvPxaygWV FWKlgG1dwX2mcOlofJwfXkaqoEufelrOUXG3B45eVDBxC8Mj+/UvLPeNKNSCjdpONWsO K32w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701725; 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=QZORbJEC0KXh3smLya7JMCOQlYUfz0b2RxRCc6FiOfI=; b=FHa0sCVOUpUTGDUIt1kDaNsAiItbJl/kWexeBE9+6DNG2uJMfUnZxjjNZmPxy4SQPd nYC8LgP9bBFcba1/2mSmavuVFR6O0xUG9rc3dvU676sK5CgaQCGau9vKBcx9JjseUp5q rsibUA4MVBuCFgJM2TV1vgnzRm09hFa+oxhD6FzLiPNamz0wGhOV1pskzTOP8xO7LNfs YWPXb6AEg2CBWO2Z+FBDbMmBVOeUsiQzhb46UO9XRgl/jthxC3OP+c+NP+k7YZ+oDsgN AyElZ53EhUDF8JbEwJCPKp8kosBMuk6qwkrC+rTeP5i0p/7GdhxTf+cpWuj6FLlKQVSp ZrwA== X-Gm-Message-State: AO0yUKWP3Ev31TsBBGLzGqKyUsywVY4fVXzp06P6kfJvDTcsD8i+rbUT 5/ogatEGui+BEuK9OYNWfAOTCQ== X-Google-Smtp-Source: AK7set82igQXDXQLDcQgalm3MHFmvQbYALKZpjviajKLfGYMlP4HXvFpebv/Sk6+euW4zOjEPAZ1mQ== X-Received: by 2002:a05:600c:4da3:b0:3ea:e4f8:be09 with SMTP id v35-20020a05600c4da300b003eae4f8be09mr5851796wmp.30.1677701724687; Wed, 01 Mar 2023 12:15:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:24 -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 , Florian Fainelli , Amit Kucheria , Zhang Rui , Markus Mayer , Broadcom internal kernel review list , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Heiko Stuebner , Jernej Skrabec , Mark Brown , 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 v5 06/18] thermal: Remove debug or error messages in get_temp() ops Date: Wed, 1 Mar 2023 21:14:34 +0100 Message-Id: <20230301201446.3713334-7-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" 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 #Armada Acked-by: Florian Fainelli #brcmstb_thermal.c Acked-by: Heiko Stuebner #rockchip --- 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 | 3 --- drivers/thermal/thermal-generic-adc.c | 5 ++--- 11 files changed, 10 insertions(+), 41 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_ther= mal.c index ebd606861a61..0e8dfa6a7757 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 60173cc83c46..72d1dbe60b8f 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 6db1882e8229..9954040d1d2c 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 f3a374266fa0..0d135b8a5b62 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 ddde4bdfc94a..2d7a6bd2846b 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 a22b8086a209..a0b8de269986 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 92b3ce426b9d..668747bd86ef 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 bf1679765f1b..61c7622d9945 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 8a51eb26e798..71e533df563a 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 6ed393218eb8..2d3042098445 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -109,7 +109,6 @@ static int st_thermal_calibration(struct st_thermal_sen= sor *sensor) static int st_thermal_get_temp(struct thermal_zone_device *th, int *temper= ature) { struct st_thermal_sensor *sensor =3D thermal_zone_device_priv(th); - struct device *dev =3D sensor->dev; unsigned int temp; unsigned int overflow; int ret; @@ -127,8 +126,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 2c283e762d81..017b0ce52122 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 Sat Sep 21 03:01:28 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 2D45CC678D4 for ; Wed, 1 Mar 2023 20:16:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229970AbjCAUQE (ORCPT ); Wed, 1 Mar 2023 15:16:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbjCAUPu (ORCPT ); Wed, 1 Mar 2023 15:15:50 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC74D4FAB9 for ; Wed, 1 Mar 2023 12:15:28 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id r18so14520832wrx.1 for ; Wed, 01 Mar 2023 12:15:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701727; 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=l/7e8N8b7gEax6Mp/tnE3jBK1MXlLnukXxRJZ25cEfk=; b=MDUIOAJCbxOoRoUdpykbKUJ/DLqedw98V6ULDsqSCrVv2DyQoKsOfFo1yWSFUMyGAH 61NLVJ3VtYPMta1yqM/+iLb07kdsrakUTAyOLkEEU/a5vc5/jnXoTNRP6EHQks2G1cYK O7H4ybns27pUTUFLhFFuX98xGnbRConr+RkP0qe2eKL5lKoqM6X29VmtxVtQ0JH8IcLG eHvacZ50yVh2fLHdZZBuivopsteFdk48clomNw6d1E8G6lW5O5HK+zqhoPZOzgRgjlxq SqVEnpRGIULjdyG+opdX3sBaoqH/nj9vxXHhbWgoHSUUEHEUxp5aw0lD2j2HfRFxWdGJ lupw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701727; 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=l/7e8N8b7gEax6Mp/tnE3jBK1MXlLnukXxRJZ25cEfk=; b=AYzxeYs9wUKZ4qLUspMVwwgPTFPllyeIv0uG5RgAJSHxxxCRd0EuiK1GQxe6koLIwa N3+jzza6styfGe5jg8BeIdauCLLub/6DEPYAcCtm1DDOjjypcLDMKCH1ulcE/bMX9/tT wEex0aITG7cKiRFt8B9C6a2PsHtpj8TCglurDXDIdDYMVySQIS/y8p9ggmIKWKE/yqBq eQtZ5tFTyWz3iR0baqhgeSiFxyiVoRPIpP6aTCGK9eFagi514mLu/+HIjvNMthgN4hSc m8NFBAHD4mCkOEsNVt0pKCHZPiBFZiZ68ulxMCixbOU3cTZw0TEuabLpdSoblFexb5Y1 EYHA== X-Gm-Message-State: AO0yUKX1fTrXc4lyyufaArf/eS0W7rBHfXCJft93TFYbPGHp97xLzi2d L7o1RiWJrziYziif11x4ibWSIQ== X-Google-Smtp-Source: AK7set9TfCp/BeD5OZI1vQMbiQ8UL9u+JNMs3gnfhvFgF02HRwETSmUApdZ7SbXWMRKNCbHrm/8nBg== X-Received: by 2002:a05:6000:1362:b0:2c7:a9ec:3 with SMTP id q2-20020a056000136200b002c7a9ec0003mr5544569wrz.65.1677701727394; Wed, 01 Mar 2023 12:15:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:27 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Florian Fainelli , Amit Kucheria , Zhang Rui , Broadcom internal kernel review list , Ray Jui , Scott Branden , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Heiko Stuebner , Jernej Skrabec , Dhruva Gole , Stefan Wahren , Mark Brown , Baolin Wang , 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 v5 07/18] thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs() Date: Wed, 1 Mar 2023 21:14:35 +0100 Message-Id: <20230301201446.3713334-8-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Niklas S=C3=B6derlund = #R-Car Signed-off-by: Daniel Lezcano Acked-by: Florian Fainelli #Broadcom Acked-by: Heiko Stuebner #rockchip --- 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 fcfcbbf044a4..c243a76a3471 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 86aaf459de37..a217d832f24e 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 2b7537ef141d..3df00c9d55ab 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 e0440f63ae77..b8571f7090aa 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 71e533df563a..bb254bdff043 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 7631430ce8a9..b56981f85306 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 Sat Sep 21 03:01:28 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 D374CC7EE36 for ; Wed, 1 Mar 2023 20:16:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230033AbjCAUQV (ORCPT ); Wed, 1 Mar 2023 15:16:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbjCAUQC (ORCPT ); Wed, 1 Mar 2023 15:16:02 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E0414FAAF for ; Wed, 1 Mar 2023 12:15:35 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id m25-20020a7bcb99000000b003e7842b75f2so259256wmi.3 for ; Wed, 01 Mar 2023 12:15:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701733; 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=noGAcNm9i/TJIg+l6poaaVPqMFcIQlGqlbm0Xx4JGsg=; b=igPsbJmChyKrV0tBylJqf19CVy6KoLOkEEGlISUBQOa+KedqN1Dj4P/bdiTQMzGNm4 mZDYkKvVWpxbyb2vc8IGx5ZD7WKqbQulvCaiyFicehoRbO5SrNrltoaEaXqymEBf/E9M rhXa7Dl1Fb2CnnXcrqyQ2nTqma9GiD4SOVs7rxkcjI6SVlPcGjN6JdQMb/7KuZmzmqdq KaPRf/AlTLlRxHBngtSZUtuPHjGIWRq1l/LsG8/JMxGIcKdsoQpcsMjDFC3brunxZaTa OR9VhmowWVIFhc5IAPiA9gGdEPc8hzJCK8zBBou6ZOXtoqsDfLSR3GW5P6sEPY2dy5dv jAqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701733; 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=noGAcNm9i/TJIg+l6poaaVPqMFcIQlGqlbm0Xx4JGsg=; b=tIH659OsloQhEYzKBJTTr+ofmwOHR9iMtFyYm4xYe+nj8T2tSMEMkLXQPVHlVdp6aj tE8IuO/0TX7+9aayMyUcGJTwNta5kZ5rDtv9Tlaw1FSSNF/3FflLDKrki6du5S/Xuqel GpFjuipKmyQxgKg80ChgxT4aI3Fhh/pYo8OQk6zn3/vSn82TC5JI4ekec5MPVkKQv9Pi rQta5rV/ExGiEN65d28c1NyLr6+QV5t2VsQPDc5lUv8RGTTQLsXSybNQKTM8VaPYyw7J yeMc418ZIYtsdLCpOotkbXpab5SdBwzbhhkCSN3R0ifvGVcNxsQiTxGXoJrE9GSwigHW zlyA== X-Gm-Message-State: AO0yUKXAxkwPCEBjVI5GjEsQzdRMDAC0xk4DXZkNFLETRBbZn7uQ7XGE QUr1qrHPFOKHnxz7P2MmcES0pg== X-Google-Smtp-Source: AK7set9Sdn/XZnAGnYPhToVNLQiDYgUKQKhOW+Z9rk4YtpbwDDms5a+ia2gtqiyDytxSf8UsjBcC5Q== X-Received: by 2002:a05:600c:4da3:b0:3ea:e4f8:be09 with SMTP id v35-20020a05600c4da300b003eae4f8be09mr5852032wmp.30.1677701733468; Wed, 01 Mar 2023 12:15:33 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:33 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Blumenstingl , Jernej Skrabec , AngeloGioacchino Del Regno , 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 , Samuel Holland , Thierry Reding , Jonathan Hunter , Eduardo Valentin , Keerthy , Matthias Brugger , Daniel Golle , Balsam CHIHI , Randy Dunlap , ye xingchen , Florian Fainelli , =?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 v5 08/18] thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() Date: Wed, 1 Mar 2023 21:14:36 +0100 Message-Id: <20230301201446.3713334-9-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 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 #amlogic= _thermal Acked-by: Jernej Skrabec #sun8i_thermal Reviewed-by: AngeloGioacchino Del Regno #MediaTek auxadc --- 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 dfcc93e45cdd..4bf36386462f 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 efa1a4ffc368..e0de6ac49469 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 2d7a6bd2846b..839bb9958f60 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 b5cd2c85e0c3..791210458606 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 755baa4e5bd2..7b146350050d 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 ed204489a950..5749149ae2e4 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 b196d8d01726..0f88e98428ac 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 6cc935379f00..d3218127e617 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 d2dc99247f61..e58756323457 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 6b550f0f90bf..793ddce72132 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 42c6fb494dd9..4b2ea17910cd 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 3e998c9799bb..216b29068b08 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 Sat Sep 21 03:01:28 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 85B4BC7EE23 for ; Wed, 1 Mar 2023 20:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjCAUQ3 (ORCPT ); Wed, 1 Mar 2023 15:16:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbjCAUQR (ORCPT ); Wed, 1 Mar 2023 15:16:17 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3616F515EB for ; Wed, 1 Mar 2023 12:15:40 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id m25-20020a7bcb99000000b003e7842b75f2so259391wmi.3 for ; Wed, 01 Mar 2023 12:15:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701738; 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=b92i5j4suI6iMes/bILYFXO036hJyAX8EiI58S1R41c=; b=Scjjoddufz1DfGYWyLG4gYxZ4y8eSi2DmsQmcIkqPp3omLIYadL8eU6Yuelv0SOiP7 LM60QZmX5TYdB1E6pW7owOoacod2pjpRxBdzlqcRf1fCp3wT3NLRH2UMrExjHgit9sX+ 5p9mGToQiWV+eynXAecNV9Pakn1tJvddqvh3BSDnQ23ob/k/T2Ua/7jQoetg+XyIHafy YyqDTkvqfb7fhN5VM7tCJLBdv5hcJ38Uz3mlW4FjDKisc4SLRMQb5Ex5J+mDlMD6BpP+ 5khFgnBgBdoDPEfZHI9RO/F95CjlChqw58ARgdtxSX0PmXFWoGPoym+jXnehh6S+/8L1 MMpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701738; 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=b92i5j4suI6iMes/bILYFXO036hJyAX8EiI58S1R41c=; b=z6QqSKZmBT/aLhOvUSX450gg0IIXcfSHwMLUZS/c11GH6R94mFUwvQDTkZ9+RSFGOX 0nY11zwix5VHTzOwVuT0Ri4RkdDxsc72spXj9YRyU0XzTo0awizHAZzvmf7GtFuN07iq +L3JKFn9wrBHxpaipkap/c4YthajU/QNLy6r7oR7D1Ax2cii02fDSKmkzAVeAxadg5au FQ9Rq6wRTIJMrXan18LYsGHKaz5cvlokCeikU64pbugoTatoO+QUF5pVOmsVh9zIwwmk 6AlN9FfH1EIwzBxfD4jPxE86kZmH+zUvRgjBmpmE6L3RXUZHWLav5IoMe8qzVqnZUwX/ 2E1Q== X-Gm-Message-State: AO0yUKWL7F69R0YL/Hr294FUuHwxWI26juEqhSAPp6knZMRL15++t28S WZy1Xk8r4roSWdabT/qiAo9zfg== X-Google-Smtp-Source: AK7set/aHNxqaSnx47sUyypc2ojGT0vB4mUbUYjNUwcqeWTM40mA/AUxrCaCjrWGaIVT72U7Li+4Aw== X-Received: by 2002:a05:600c:1f0e:b0:3e7:95ba:e1c7 with SMTP id bd14-20020a05600c1f0e00b003e795bae1c7mr6244399wmb.32.1677701738545; Wed, 01 Mar 2023 12:15:38 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:37 -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 , Balsam CHIHI , AngeloGioacchino Del Regno , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Eduardo Valentin , Keerthy , Matthias Brugger , Baolin Wang , 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 v5 09/18] thermal: Don't use 'device' internal thermal zone structure field Date: Wed, 1 Mar 2023 21:14:37 +0100 Message-Id: <20230301201446.3713334-10-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" 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. Cc: Jean Delvare Cc: Guenter Roeck Signed-off-by: Daniel Lezcano Reviewed-by: Balsam CHIHI #Mediatek LVTS Reviewed-by: AngeloGioacchino Del Regno #MediaTek LVTS --- 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 a0b8de269986..c3136978adee 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 fb4b1b4db245..beb835d644e2 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 216b29068b08..060f46cea5ff 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 Sat Sep 21 03:01:28 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 98478C7EE30 for ; Wed, 1 Mar 2023 20:16:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbjCAUQZ (ORCPT ); Wed, 1 Mar 2023 15:16:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjCAUQQ (ORCPT ); Wed, 1 Mar 2023 15:16:16 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 250DE515E1 for ; Wed, 1 Mar 2023 12:15:40 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id k37so9418242wms.0 for ; Wed, 01 Mar 2023 12:15:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701739; 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=/h75YgLAzThWP+FOpMQKnxnohte85PKa1jrYzQU01Og=; b=WKe6cSzLuNxCWv5cfrvDiwJDrEwzeE/mWN6+yWAMx5REI02vy8GlFV5xvHGvGMfBs3 5oph0BkZOkO/2zlT8/IWB4nbf/wSpjP88FxwKjQdmIBiHGS/KPvr2AldgPLHj1AiE8Pe zZ6dCR2gHILz+CzYBlIWgGzoPAhIt1vvNeGFQ9a6XwUSDv8vxoICjInjw1rA4wyZmFp7 ITCts9r2XErCRLRG4va+oiBfNHJo7G2Pyhg3nv+V+zkiTZj7S9lZCh30ACJsJOl7jo+R /mMU2bpwXmXEDOaNNmBW+IRqrHJWRIMmB+DFKyxVsbAg/XHxnMYoZJudTh9n9SkLucyH uqJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701739; 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=/h75YgLAzThWP+FOpMQKnxnohte85PKa1jrYzQU01Og=; b=cNxaWc7JehoJ0DMbmGOIuH0jHJ1MGJwGpnSxxiNf1jxLzHOKHcxbvwCLtDYerYcY/l Qze8RueEcUGEpI3l2S2zR8ejSlE70H+0qlgr4DCmamT4jUlr8CpzvJngZmRW00Ex13Ju tao7QNDN2BNkfwgfTkCvdkOR70py8x6Bbzzc92vGxyOOWrrcnTqnavk7tI/FRpue0Q3t g1SAvfJ7V5e2GPqtZXDTfThyy5MZA8pRCyNTwmX/Xfcdf1CPJk2ZCu92EfoTFvi0+rs8 43+JJKsI5CWjdHTM6dNZ49ls3qZxIttPq6M50EjH1NVNpTobJAIostRpP4jTExbE71gc F85Q== X-Gm-Message-State: AO0yUKUs3CXtyVeFX7BNperdv2lezaXyc2XHs+KJoVuQECb3roXTvqGr jcNS03EqXvNZrFXUiD5Umd6uyQ== X-Google-Smtp-Source: AK7set98qZ9E/L3QjFj0q/InIIObqL00S5rF2lAu6706tefYT4w4YWcBpnM4Xdrc4MEy5viAbU4Kug== X-Received: by 2002:a05:600c:3506:b0:3ea:e5fc:a5a4 with SMTP id h6-20020a05600c350600b003eae5fca5a4mr6201164wmq.1.1677701739489; Wed, 01 Mar 2023 12:15:39 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:39 -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 v5 10/18] thermal/core: Add thermal_zone_device structure 'type' accessor Date: Wed, 1 Mar 2023 21:14:38 +0100 Message-Id: <20230301201446.3713334-11-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 via the exported thermal.h header. This structure should stay private the thermal core code. In order to encapsulate the structure, let's add an accessor to get the 'type' of the thermal zone. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 6 ++++++ include/linux/thermal.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9fa12147fead..913ba9ca9792 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1384,6 +1384,12 @@ void *thermal_zone_device_priv(struct thermal_zone_d= evice *tzd) } EXPORT_SYMBOL_GPL(thermal_zone_device_priv); =20 +const char *thermal_zone_device_type(struct thermal_zone_device *tzd) +{ + return tzd->type; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_type); + /** * 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 7dbb5712434c..21686e676b3d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -366,6 +366,7 @@ thermal_zone_device_register_with_trips(const char *, s= truct thermal_trip *, int struct thermal_zone_params *, int, int); =20 void *thermal_zone_device_priv(struct thermal_zone_device *tzd); +const char *thermal_zone_device_type(struct thermal_zone_device *tzd); =20 int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, @@ -443,6 +444,11 @@ static inline void *thermal_zone_device_priv(struct th= ermal_zone_device *tz) return NULL; } =20 +static inline const char *thermal_zone_device_type(struct thermal_zone_dev= ice *tzd) +{ + return NULL; +} + static inline int thermal_zone_device_enable(struct thermal_zone_device *t= z) { return -ENODEV; } =20 --=20 2.34.1 From nobody Sat Sep 21 03:01:28 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 0A48BC678D4 for ; Wed, 1 Mar 2023 20:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbjCAUQb (ORCPT ); Wed, 1 Mar 2023 15:16:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjCAUQR (ORCPT ); Wed, 1 Mar 2023 15:16:17 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3165649884 for ; Wed, 1 Mar 2023 12:15:42 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id k37so9418268wms.0 for ; Wed, 01 Mar 2023 12:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701740; 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=MVdgWpAFCojRfEmtrK5jCjMCpct5NgUpVAZqrr++Uhs=; b=S2RD3t39aOcAjADtvbfn2VOvpvaTF/lJry2CokRv1cbcRY9sR8q2wa0e6ifexfGhVP 6qDOnbMxuegflcU5lSO2YwYpN5dpXp/qjdWxsHaGVCmw6mJXVvWRnaAuEWvPjPrhLVYy g3l984PPao4CAPL7k2m068EP0zrDricnkqPUQ8x6IiHtFFsxICFggHpQTctZKtkK3hgq xygC8Q4ak+4aXJHv/W3Q2uKRzysV1hORN6vzHFSoR0klSVjYbxUGEgWgjlIpAj964NNE pDTKWfRnBgN4S1d2vRCtB04R5xHGlGbRhQiJNNc15ddBm81kD8Au9fnEIvaokSS/yHxR runw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701740; 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=MVdgWpAFCojRfEmtrK5jCjMCpct5NgUpVAZqrr++Uhs=; b=27SlqVEair2Jtg8sBk0PBBG4bjcBaReYnY31MaicsAu4nA0HHw89Kx0Ykcla7ZoLCJ Ox4pp2fX1f5hUyFf+4g/+NlERnYl1JUSTSZVpWJWayDExuTuSlXUD2Sek2BmA3c2qrya iZeacSJYdEsJNs0WW0AoaB4YXOPZmEkfPkmH+iAJkYHk7ybFFCpESLFg9DIacTYPnsFh azMbLmFNi8y2Tkha6juIupAHpJKhlxu+N03HkVo/x/JWE9hQdB2KNpeBWFu2VIYHSTVq 0RU9AukKQcDXXuYKXLbgzHnwlF6n9n8MI/vZ1+UrSaMMnjIuBQvaCCW0zVjdk7d0TCGx LDqA== X-Gm-Message-State: AO0yUKX1F8gNEPKR1gHDvwg3M/rCyqdH4FFDSxG1R651mcGjKRwM6ym7 yAIW4+s2/S+aLykepLRw8ihS3g== X-Google-Smtp-Source: AK7set9Z1MVQyYdm9AeVnKhEPeO6y7ydvQ4G3I3+bUnrRbQlbWRAA2vhkypDegGjRCb7Ey5Kj+Idcw== X-Received: by 2002:a05:600c:4fcc:b0:3ea:9530:22a6 with SMTP id o12-20020a05600c4fcc00b003ea953022a6mr12712060wmq.1.1677701740585; Wed, 01 Mar 2023 12:15:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:40 -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 v5 11/18] thermal/drivers/spear: Don't use tz->device but pdev->dev Date: Wed, 1 Mar 2023 21:14:39 +0100 Message-Id: <20230301201446.3713334-12-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" 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 653439b965c8..6e78616a576e 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 Sat Sep 21 03:01:28 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 A144DC7EE36 for ; Wed, 1 Mar 2023 20:16:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229948AbjCAUQi (ORCPT ); Wed, 1 Mar 2023 15:16:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbjCAUQR (ORCPT ); Wed, 1 Mar 2023 15:16:17 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B17548E30 for ; Wed, 1 Mar 2023 12:15:43 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id d41-20020a05600c4c2900b003e9e066550fso257267wmp.4 for ; Wed, 01 Mar 2023 12:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701742; 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=BXmjkOh9eXvrRm2J04oJvypw5mYaRO/S2JmWwbjlE4k=; b=KJoDrEWTmy/NGzToMLWxtKnUldmaeCsojugTM6oVamuY0Dfznyw2ev6/AtrLpBpX78 FJBcL9HwqclegUuN0SGxvJMQA8Z8RFoWrdgIM4MbXyL2O/gJ+FVc6JIHoHmt0aOa6KV+ UQV+RSa5racDGMUvTs4/a2UEFXYl60HUx3walKVwiO8Kff5EgqZg+zCug9lnP7oOJxan g5xF6BWrDb9pGfa8lMKXajNIArv2DqL3zJ6do1C/x/vVqPNlvqmtVBEZzd1TNz7aKhfs OrjJFvnpNw3AG/tq6HzOCeCtbpD67dvYQE4wAkaUqep7wlYjP6vdY1zJOH0FhFkGzLk/ fB9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701742; 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=BXmjkOh9eXvrRm2J04oJvypw5mYaRO/S2JmWwbjlE4k=; b=fGwgxKniR8v+BSJyTnVeVOjfpM9O9mxLIWgjtEBvk4CfiTcjy5K7K6SoY5fQaSLYOP NdvKByv4BXNmq9jWV0s5yh4gaV8I4FoIdD7FFM4fYTlLa7hcYHZuvvaikc/CC9kZxESS GWETBcK87KBah/gQ9xcthj9iOoEkXsP1L4tQUoB/5jjTYfDnMcG8IDOqLYoo5TMaciDk sAZJw7xAHY1YYYvu/+k6Em55GvqmpN9+4giSDXAi0V78R7LP6n4URpDllm1h/mG9B1A4 BHRYde4z1+eYYbUZJzjRuR4PhdySS70z+CYZPxhWjEYmf3aJWj9JK5zmdEKyzmP+USYQ zkaw== X-Gm-Message-State: AO0yUKXkb2g0MJItfMNALCqr/sqcQXYMdOY4G6JsKL2obqNQel5Ul7Mr WnzKhJReBFjtzFnwOMXM1Wxj2w== X-Google-Smtp-Source: AK7set9Y+lo4lJMEQqXLfkt4NEKJYCYGDNJF8VXOADThZ4VevLaauLXcV1uozTeVimMNJB0O4WzttQ== X-Received: by 2002:a05:600c:310b:b0:3eb:323e:de79 with SMTP id g11-20020a05600c310b00b003eb323ede79mr5805046wmo.6.1677701741785; Wed, 01 Mar 2023 12:15:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:41 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , "Rafael J . Wysocki" , Zhang Rui , Len Brown , Jean Delvare , Amit Kucheria , linux-acpi@vger.kernel.org (open list:ACPI THERMAL DRIVER), linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v5 12/18] thermal: Add a thermal zone id accessor Date: Wed, 1 Mar 2023 21:14:40 +0100 Message-Id: <20230301201446.3713334-13-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" In order to get the thermal zone id but without directly accessing the thermal zone device structure, add an accessor. Use the accessor in the hwmon_scmi and acpi_thermal. No functional change intented. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck Acked-by: Rafael J. Wysocki --- drivers/acpi/thermal.c | 2 +- drivers/hwmon/scmi-hwmon.c | 2 +- drivers/thermal/thermal_core.c | 6 ++++++ include/linux/thermal.h | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 392b73b3e269..255efa73ed70 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_id(tz->thermal_zone)); =20 return 0; =20 diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 046ac157749d..364199b332c0 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_id(tzd)); } =20 return 0; diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 913ba9ca9792..46dedfe061df 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1390,6 +1390,12 @@ const char *thermal_zone_device_type(struct thermal_= zone_device *tzd) } EXPORT_SYMBOL_GPL(thermal_zone_device_type); =20 +int thermal_zone_device_id(struct thermal_zone_device *tzd) +{ + return tzd->id; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_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 21686e676b3d..eb80cee4f64f 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -367,6 +367,7 @@ thermal_zone_device_register_with_trips(const char *, s= truct thermal_trip *, int =20 void *thermal_zone_device_priv(struct thermal_zone_device *tzd); const char *thermal_zone_device_type(struct thermal_zone_device *tzd); +int thermal_zone_device_id(struct thermal_zone_device *tzd); =20 int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, @@ -449,6 +450,11 @@ static inline const char *thermal_zone_device_type(str= uct thermal_zone_device *t return NULL; } =20 +static inline int thermal_zone_device_id(struct thermal_zone_device *tzd) +{ + return -ENODEV; +} + static inline int thermal_zone_device_enable(struct thermal_zone_device *t= z) { return -ENODEV; } =20 --=20 2.34.1 From nobody Sat Sep 21 03:01:28 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 47C79C678D4 for ; Wed, 1 Mar 2023 20:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230008AbjCAUQl (ORCPT ); Wed, 1 Mar 2023 15:16:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbjCAUQS (ORCPT ); Wed, 1 Mar 2023 15:16:18 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC70748E06 for ; Wed, 1 Mar 2023 12:15:46 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id l7-20020a05600c1d0700b003eb5e6d906bso197432wms.5 for ; Wed, 01 Mar 2023 12:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701746; 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=dexA46MbFD/1LJf//eW76xTgHB+gKrlRAfZ8jnkaOvM=; b=ukkjFNfgK59eu1LeshuNmpkbqUe+57GbYmcQvpYODW4eZc+/Eq6TviqWeezCFCnshm virQlpn5g0pq5dm0tCb4La0RxiEepuXJ0ATEarJnTRo5L8kW0LuVLeL/QTLb/cYJ2876 cQbDvyf6N2XuYiBCXId7qImjTLXYL2KmFERCHLCfpfWgff35YPxmw669uMYTZEI6Od5x u0AdvvvxIOdT5F0INCtrz755ZtjnqQ6UMFMVp+avsAlis1j1mLMZYvb8AB88hrq18UWh HlmsLFhEVn9Xin7EvoiMYtCOV5K6vMHyJsJZJ8i3AV3jxXkr2z/oBGTV8Eow78dq+qQs GVxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701746; 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=dexA46MbFD/1LJf//eW76xTgHB+gKrlRAfZ8jnkaOvM=; b=MuiEAGYUBswcs+ZLFxuBtBsghr1Be68D/p9Ky0LDwIA60ns4KP79Q1tBV8EZpw6BW4 NVXym80r6yLU9dSeiGQyMzB5o5cXX4caqS+bg3086ePjC/YRy2hi6yLPMoPlkISMCF0S XqA2A1HVIGAb23yZyOD0pCnwmu9J020L4AuAFDo75gdSlPA0CwdNwmksHwBKic6b2mx9 hmZXE0W9GidY9LWoeQnApwpzwcMJQ2H4iHKPlmHHHYyUuaLQcrMnx8NUDGz7bf21RBWu 0Qazq2LD2jGHLkjSiOoqvs2NJj9Jx7YixX7ETndJXpd7oDqeCrw/x6z2uqR+NqEfvHMU VSnQ== X-Gm-Message-State: AO0yUKWNGy46aNTFWSBGtdsB4ODrQ2rMSBUf1K2DsjNKhJ+a0XxI17r9 G3hbEzeZNaCF4OigvwupfhxzDg== X-Google-Smtp-Source: AK7set9sVSbQhQevjSNopAXDfJiA3HK0YMzMlVoLJ/jyJ4/SWnabQbYwdqwMzhMc8PU0zFG7/gjZ9g== X-Received: by 2002:a05:600c:30d3:b0:3eb:376e:2b9c with SMTP id h19-20020a05600c30d300b003eb376e2b9cmr5682213wmn.36.1677701746296; Wed, 01 Mar 2023 12:15:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:45 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ido Schimmel , AngeloGioacchino Del Regno , Petr Machata , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Amit Kucheria , Zhang Rui , Eduardo Valentin , Keerthy , Matthias Brugger , Balsam CHIHI , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Mark Brown , 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 v5 13/18] thermal: Use thermal_zone_device_type() accessor Date: Wed, 1 Mar 2023 21:14:41 +0100 Message-Id: <20230301201446.3713334-14-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" Replace the accesses to 'tz->type' by its accessor version in order to self-encapsulate the thermal_zone_device structure. Signed-off-by: Daniel Lezcano Reviewed-by: Ido Schimmel #mlxsw Reviewed-by: AngeloGioacchino Del Regno #MediaTek LVTS --- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 2 +- drivers/thermal/mediatek/lvts_thermal.c | 6 ++++-- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/n= et/ethernet/mellanox/mlxsw/core_thermal.c index 722e4a40afef..b0a169e68df9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -177,7 +177,7 @@ 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); + thermal_zone_device_type(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 beb835d644e2..216f53eb1385 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -305,7 +305,8 @@ 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) { - pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, = low); + pr_debug("%s: Setting low limit temperature interrupt: %d\n", + thermal_zone_device_type(tz), low); writel(raw_low, LVTS_H2NTHRE(base)); } =20 @@ -318,7 +319,8 @@ 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); + pr_debug("%s: Setting high limit temperature interrupt: %d\n", + thermal_zone_device_type(tz), 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 060f46cea5ff..0c8914017c18 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -44,7 +44,7 @@ static void ti_thermal_work(struct work_struct *work) 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); + thermal_zone_device_type(data->ti_thermal)); } =20 /** --=20 2.34.1 From nobody Sat Sep 21 03:01:28 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 92BA2C7EE23 for ; Wed, 1 Mar 2023 20:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbjCAUQs (ORCPT ); Wed, 1 Mar 2023 15:16:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbjCAUQT (ORCPT ); Wed, 1 Mar 2023 15:16:19 -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 7C0D4515E7 for ; Wed, 1 Mar 2023 12:15:53 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id q16so14524375wrw.2 for ; Wed, 01 Mar 2023 12:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701747; 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=B+RTeMjiH2Yk42W57PYAK6Mb85gdhTfPcaFRy4giwH0=; b=oq9JmkyeN552QfxOHHg4bR675vpphKbJsVoET11pinW7JQA+jqNXdJAr4H1KeeIZLU quTT2XEFLZfpGXGmqt2GO3lv4+gc2zqQ+Ojc2d/tm27K8VJztJR335Qr8mw4MzS/E9Mz AJxjpbRQ0bAh0BqAwgG6cJqrC/+/3jeTdI2v4aL/EnfGrdR0xf/9Ro7D9XB3rCMkF5/m smlEDf+3lK2/eNKbRQDrxdiOY9HCMyhT32kugRCJAZ2370lxSv0oxFzXGWMtal4bHE+Z OWGL81xIsLH2AKPqAwerfg+8F5V55ajFRIivK0ssQ7qKldceNtaF/Bs0K+He2rMYwu1I DmgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701747; 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=B+RTeMjiH2Yk42W57PYAK6Mb85gdhTfPcaFRy4giwH0=; b=giZ5nk4HW71goFre8cnLJdU4xIcqJtQS18MpLuc8GjUDUkp4W4LdvkXcOShas2lXhd 0umg2evydPHE5gyWskowk/B05YPLg/PEODzDgPy6gVWmSGmt7LrwU3Q9JAENissuFFvb ODJvbaVysgPmKHW9kE6lUhjTatji1pBGT5rDQZISgxaUtcVIaLAu9keI0e97zsbfV6f1 701cdGsp5q32lllBa2/W9UO72J/z0oH9AKUSAjpSC+hb0ZiejeM0Jnb7fL+QnfmPpBRi fZH2V9I2F1Ld0I0gRf1DLHOAUYyHsJAAQ9wWtSxPgZFOqVf95cMvaMNCuHhPWENUocI1 W1Fw== X-Gm-Message-State: AO0yUKVhqbn9zj8qgOtl1gIQVaBMHyYEVZWyaZiDpceIr6G69tATSz+X J4e98hsI/pKGcHHgmZ3i07IX9g== X-Google-Smtp-Source: AK7set/ta+emcyYFeYNSomT5+PEoW2hHSBBrGWkfa4OG0hChcsGtB27pUUXj1KAZ2oYslu7puUedzA== X-Received: by 2002:adf:ed82:0:b0:2c7:a39:7453 with SMTP id c2-20020adfed82000000b002c70a397453mr5688650wro.54.1677701747255; Wed, 01 Mar 2023 12:15:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15: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, Adam Ward , Support Opensource , Amit Kucheria , Zhang Rui Subject: [PATCH v5 14/18] thermal/drivers/da9062: Don't access the thermal zone device fields Date: Wed, 1 Mar 2023 21:14:42 +0100 Message-Id: <20230301201446.3713334-15-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 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 Reviewed-by: Adam Ward --- 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 e7097f354750..2d31b1f73423 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 Sat Sep 21 03:01:28 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 36A98C7EE30 for ; Wed, 1 Mar 2023 20:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230086AbjCAUQp (ORCPT ); Wed, 1 Mar 2023 15:16:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbjCAUQS (ORCPT ); Wed, 1 Mar 2023 15:16:18 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D64874740C for ; Wed, 1 Mar 2023 12:15:48 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id p16so9366398wmq.5 for ; Wed, 01 Mar 2023 12:15:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701748; 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=tS0guMTDp+HnyAw7+AQL4Z1IASYNHpKANmt65sLAMFo=; b=eKlbzTcQEFboy8VZXWl8pPk/FXRsZlMf6FKVXjp2UUBsWWWqzXQTW9pnCQ2Vqlmj7D 8UjwL8Yw5YHQjMLfOexzhkOlPQk9c0cmI4IfOflMQcA/clY+jtznBFL3m1FYYEbGdiDS XKTaeiR2LXUdz6HcSz6bhszvAR4xTZ9HR6QbubfAgJklixqSnnulZB2Ol8IGCtRU+vDT hMZS3hHRHqesSwndxNEw7nD8ZU9MPL+Va/KpJKAk4Z5Ice7O3RmiQbGXra6a67mERp9j vc+5c7s/r9ombVX9U70Pkc0GWlD7EJ3rY0bJ9MluJ6TYbrXbO0CL4gXWc7VmTwldB0Wn ZQzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701748; 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=tS0guMTDp+HnyAw7+AQL4Z1IASYNHpKANmt65sLAMFo=; b=i6KdLMV9UGOhIFcpyOzjIPvJpAySW6Blq4sq6er7y/+Cruw5+5iHH+GPu1uHlcyBTe uU3FA1sv/3YMDHsReFqiDFZsIgOz5V89IjjWKW8QhEOvRMOw7sU5K+JzktHHSHX6KYA5 wIDbbP2PVZEoYWY36LvM2LQ/YUtqSMhdqgGRg5Ut1Eog2tkpZx5nqkDvWQtuHiRARF6E kl9laMgbLQpPAqQ3iSUrbG2NujdLJGSClP4GOdZN/UvB9EjRzhbA+/uNVrNRCFGJm2be m7GOvqPiHZTA9u0Vo4yv4HnYxxI48oB1dRG9RJoSXlBx2EpcVWWaB9zSJ9LdLno5PlVa uLuQ== X-Gm-Message-State: AO0yUKXB58Rzn6dZfruEz/TUzs8bVhA9bl9Y/ZINHzdyqEBmLmhUgcYa 6s0NfFwogidknFyu69GiegBr9w== X-Google-Smtp-Source: AK7set8XjOgbxSfKBNwtsRvagJljKV2UG0lSsXcgjMhQzhiTwMigOG6ujpgoQOSfvt1xvuQuKgAQJw== X-Received: by 2002:a05:600c:3495:b0:3de:a525:1d05 with SMTP id a21-20020a05600c349500b003dea5251d05mr6246294wmq.8.1677701748312; Wed, 01 Mar 2023 12:15:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:47 -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 , Jean Delvare , Amit Kucheria , Zhang Rui Subject: [PATCH v5 15/18] thermal/hwmon: Use the thermal_core.h header Date: Wed, 1 Mar 2023 21:14:43 +0100 Message-Id: <20230301201446.3713334-16-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_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. Cc: Jean Delvare Cc: Guenter Roeck Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck Reviewed-by: Jean Delvare --- 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 bc02095b314c..c59db17dddd6 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 Sat Sep 21 03:01:28 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 950FFC678D4 for ; Wed, 1 Mar 2023 20:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230102AbjCAUQw (ORCPT ); Wed, 1 Mar 2023 15:16:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229971AbjCAUQU (ORCPT ); Wed, 1 Mar 2023 15:16:20 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B67251F88 for ; Wed, 1 Mar 2023 12:15:55 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so264065wmq.1 for ; Wed, 01 Mar 2023 12:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701750; 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=koJPR2fTStLYORfVp08sS7+PQVK0D33ZKiTZpjngJoo=; b=SBVcWfNmCmLQAwaNijwS/wnXrU1y3WvMrSoMghzjYjl0kvFkNMInBeeJZdFABFHmo0 WsBH9PAEK1WyhcG0S2o5GhPdcPflLJvSe3ee72kSNxlc+Avrw3TyI8t6Xc5sBr6WukqD oGttmqKYRrutn8kIbY3fyKh4Sta8TvN38JDZqitiEp00lpU1D0Bwo4DVGnLILMdjSAkz FD0dnmxKFZHG7NPaKfT6Bw104u7ia/tuXSWp+hAWb9QBlDn2HrPr/qsYq+Yb5woR/4pi c6OQ14RqG8CRMqNfe+uZGTKWjurbEHKLw1wigkauculhTEEALJx8tiyOTXCY1geTrL+X 1ZhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701750; 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=koJPR2fTStLYORfVp08sS7+PQVK0D33ZKiTZpjngJoo=; b=PhtRSmTENWbGXHbjXN0zOO5qmb9XyxfpebUDTS2Yy3o2+m+PBZFF7JEYq+GoSxB61T k/M+LMrE3ac4K85s8YX+UmzrzHT567IxIDepAq1uTdub026vkbzqZoaNzhTNFCCIY7Ab 80XDXEJFo/UVoNDhX3Y+FQ8wAu2fvoQfqB4vTUeObH68LlGuEhn74Wp4Cwi4dpinhBT7 cZh5+dJNPR8a4fOVEi754Dc8/+uo19vy2HTQQsx7Y+jEZ/43O1Gmz9fA40XFPgDHhlOp nKm+iE7r3dNMwsx1NSeB7WjABsE6svsG9Bg8ASR56eqxguSpKPncD0LjcHQhyDz4R2W4 i8Sw== X-Gm-Message-State: AO0yUKXo/xQk332S95Zj0z/I4bTwVJYJx7Me7XpC5tbmpp11kLujroAv vS4G0rxtosoA2THG1zl/n0n5Xg== X-Google-Smtp-Source: AK7set/3sxifAPk6zZfdQQkJo9RNfG+PbYT/A9+2SLhfqM4/LduE3SU0oUGzRKLmJXJkkXU3oNDbhQ== X-Received: by 2002:a05:600c:92a:b0:3ea:c100:e974 with SMTP id m42-20020a05600c092a00b003eac100e974mr6557309wmp.26.1677701750119; Wed, 01 Mar 2023 12:15:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15: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, Thierry Reding , Amit Kucheria , Zhang Rui , Jonathan Hunter , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , AngeloGioacchino Del Regno , Florian Fainelli , Jernej Skrabec , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v5 16/18] thermal/drivers/tegra: Remove unneeded lock when setting a trip point Date: Wed, 1 Mar 2023 21:14:44 +0100 Message-Id: <20230301201446.3713334-17-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 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. Enable the channels before setting up the interrupt. We close the potential race window without using the thermal zone's lock. Signed-off-by: Daniel Lezcano Suggested-by: Thierry Reding Acked-by: Thierry Reding --- drivers/thermal/tegra/tegra30-tsensor.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegr= a/tegra30-tsensor.c index 4b2ea17910cd..cb584a5735ed 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); @@ -585,6 +580,20 @@ static int tegra_tsensor_probe(struct platform_device = *pdev) return err; } =20 + /* + * Enable the channels before setting 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. + */ + for (i =3D 0; i < ARRAY_SIZE(ts->ch); i++) { + err =3D tegra_tsensor_enable_hw_channel(ts, i); + if (err) + return err; + } + err =3D devm_request_threaded_irq(&pdev->dev, irq, NULL, tegra_tsensor_isr, IRQF_ONESHOT, "tegra_tsensor", ts); @@ -592,12 +601,6 @@ static int tegra_tsensor_probe(struct platform_device = *pdev) return dev_err_probe(&pdev->dev, err, "failed to request interrupt\n"); =20 - for (i =3D 0; i < ARRAY_SIZE(ts->ch); i++) { - err =3D tegra_tsensor_enable_hw_channel(ts, i); - if (err) - return err; - } - return 0; } =20 --=20 2.34.1 From nobody Sat Sep 21 03:01:28 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 D8C7FC7EE39 for ; Wed, 1 Mar 2023 20:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbjCAURA (ORCPT ); Wed, 1 Mar 2023 15:17:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229931AbjCAUQU (ORCPT ); Wed, 1 Mar 2023 15:16:20 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1D7151F8B for ; Wed, 1 Mar 2023 12:15:56 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id j2so14483230wrh.9 for ; Wed, 01 Mar 2023 12:15:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701751; 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=GP9BUpkAAnItZXgZisVn1kO1oz9qmtA+bV8jqWpOtJM=; b=w20389TVo7cyTMlF1uBdGLoV3aG9r8YnIBrEEaUmS9NigcXApbhiu+OjC9ruIiIyfC qNCdf4BKsBXu3pPRYxFsPeKFTm3gYDg3uMAMMVTVEmgan5U/bqXsoEB63X4rxO4Pn3lr STj1QF6J54achUo1iLzZTLul3chly+tXnbQHYT169j5RNdJk3Y6c2r7Xh4gZvAzZ260/ HszIq/U4S41qFWXpL71jXGfFIngIdvBLkbXJPomnbPjLWH86lNjdQSlBWb07wjK6vtGl 5QAIn0Ux8tUZW/347UD7g6foztFrY++6eH+t7cDjy8ddi5k7jnpowdUOs2fBgR2KDJUs +70w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701751; 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=GP9BUpkAAnItZXgZisVn1kO1oz9qmtA+bV8jqWpOtJM=; b=vNfuzPEtzZFzTAygtR3d2d9ls6gKZgaJ3+62GA67c7J1wuSzNnrtW6ed7yySAQJHcq dJ6H9sabN+2hoxnbvCSpC9nPe9E0nwwrU4FasgaNjieqrszwOba/31E/COnsOvRWI9zE vwBgnG7HIWCRyZAeYLFkRdN9zOkCLpVeNS01HaJ38jovXRzc4KpUlrzp4Ln2NwXo/3jC tfr+iVVGw4hEEC/S/TU0DtxssBvClcHkcpAucMADrcfbN20fQhn0Iiw6EgH/o13/qtNB qM0m2oIYsy4pEOQ6ncRYSSmNSRaCufOWzLm8DWQ4sdWledzIzX5Vpvr2qQdIYXkAuIjY dAOA== X-Gm-Message-State: AO0yUKU7Wfzn3dj0NHmpxe2YRQe5Jz0+lELzspjEBs7V9HiTVM0QPP9M uVhfGbu46LaVVUxa5vE88VUIqg== X-Google-Smtp-Source: AK7set8XUqwRo5r5lojj7sUCgZls1QjoUg3zR+RESxHPeB+d5LlWXJhnxfeLre8oPm3UQJDLA0WWYg== X-Received: by 2002:adf:ff8f:0:b0:2c7:1757:3a8e with SMTP id j15-20020adfff8f000000b002c717573a8emr5126686wrr.34.1677701751124; Wed, 01 Mar 2023 12:15:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:50 -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 v5 17/18] thermal/drivers/acerhdf: Make interval setting only at module load time Date: Wed, 1 Mar 2023 21:14:45 +0100 Message-Id: <20230301201446.3713334-18-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 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 Reviewed-by: Hans de Goede --- 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 Sat Sep 21 03:01:28 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 E5FBCC678D4 for ; Wed, 1 Mar 2023 20:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbjCAURD (ORCPT ); Wed, 1 Mar 2023 15:17:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbjCAUQV (ORCPT ); Wed, 1 Mar 2023 15:16:21 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1195451F85 for ; Wed, 1 Mar 2023 12:16:00 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id o38-20020a05600c512600b003e8320d1c11so1124893wms.1 for ; Wed, 01 Mar 2023 12:15:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701752; 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=FS5MMzUrtYY5N2w5QCadh2L/6Lyuv9jfcaqNKoRqTRU=; b=Wh1pDVCEqhjlJTafWbx23xgrU9MTAStk8awP1aqswW8Gi720ZllVpBTdpV3pypOdWz 2/1vcLJXoc2h8DLn7W+CYb7HiFJpY7f/LNhRdj9ryZbyr7m8zfnh18M7I6xmMREEqzNb E47oMtCLR2ltG9x6r3qAYDSCAlyuIENYjlwWtwF0VQ8JGHJVJ6W/gRJXjsJOmz9UUGL6 SGa/FjUFqa4l4hfO97J8INxHyV02noj65Yz08aDuXf5G4HQO77iriljdBwmilKvw8MQX 4kMJ5yIx2ReX6Pl9Cio9VyyByqM4ZHizUjCXu3kUXuUbTX0s0ADV336rk7PqnW4mGKxm AZpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701752; 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=FS5MMzUrtYY5N2w5QCadh2L/6Lyuv9jfcaqNKoRqTRU=; b=PBN9bikiI2egpVCvC9Ry9XXcmlfYjhY62uRK9F2upd6JC7S3cQOmyimB9hH00m5A7U pikSn8qz+WNV7W/iuvUbefphIyom2nHKry0qUkKcmkY8r/RfgG2Sq6PVmyGoheInyflP ZG3+7TLcKvXMoiTJMZO/yIJXY6omdRzPuNH0puiWleKCsbwB+4C33vfOULG5v903MJqq dPN4FT25bXxFNvHqPk2pJcwD9spVeaUIJmk8EI8FLejbeNdmMRwwnJsLshZ2S83vx298 NJPbN3j46n7r1hdaFUVJ8TF2rv11BihiLwtke8s8fU9yPE4Uahngt5dQIzfdchbiq76s d82A== X-Gm-Message-State: AO0yUKVuqPtKk/A4VSaE1eswzJMCMhKl899CRC+l9DhX1Xpa7967AXs5 S7uVjuIf6Ya+vlaWEJbdYN+e6g== X-Google-Smtp-Source: AK7set9/48B3UkJzRbD9ghUuPOZUq417aVxqF4bZ/zrpzF6PhFApIvpjoxt3GWWtJuYzeCOE4ikdug== X-Received: by 2002:a05:600c:1716:b0:3eb:2e66:9 with SMTP id c22-20020a05600c171600b003eb2e660009mr6538243wmn.30.1677701752097; Wed, 01 Mar 2023 12:15:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:51 -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 v5 18/18] thermal/drivers/acerhdf: Remove pointless governor test Date: Wed, 1 Mar 2023 21:14:46 +0100 Message-Id: <20230301201446.3713334-19-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 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