From patchwork Wed Mar 1 20:14:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658037 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 1B744C7EE23 for ; Wed, 1 Mar 2023 20:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbjCAUPZ (ORCPT ); Wed, 1 Mar 2023 15:15:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbjCAUPG (ORCPT ); Wed, 1 Mar 2023 15:15:06 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B3CE41B65 for ; Wed, 1 Mar 2023 12:14:58 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id t15so14498470wrz.7 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=ElGQgG82Boli5e4BtrRUnecIIKvQjkbtGAJTm5DBzzzFlEjFh7+J4scFIpG+siJOgq FaN9vWg6kTdgvy4eDOeNmNkjgRFMlYs8lWbNh3mZd3Ww8Ti7aCarHmgm55XuzQahka6m n74fmvsQIH1KVL9AkKVJseOt5/hZ0FYiVH3qX+dLNrSrtyqa08yjoDk+e1sKtP2c2eoA GQllCyvcpONh7M5DceU4cshjzyZh0fHssihKUHtUzECz4w5t0pDfw91g3oz+MMxJFG/H gr5PNePgb2x5T/TrRX6pAyRZ1tUsL27ay3iHSFxJEcCd5SEgfWt6fkjIYN2v77ObsIvT EFGg== X-Gm-Message-State: AO0yUKUZi6GHDr8tWhKG5Fgj+NgXQiaP7Q9N0FjSczS7tKQ1Oa0f5VfJ d3eF9qylQ4V+kNIZhZbHgmX8sQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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. 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_register(const char *type, int n } EXPORT_SYMBOL_GPL(thermal_zone_device_register); +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 device * @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 *, struct thermal_trip *, int void *, struct thermal_zone_device_ops *, struct thermal_zone_params *, int, int); +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; } +static inline void *thermal_zone_device_priv(struct thermal_zone_device *tz) +{ + return NULL; +} + static inline int thermal_zone_device_enable(struct thermal_zone_device *tz) { return -ENODEV; } From patchwork Wed Mar 1 20:14:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658036 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 BCDF2C83003 for ; Wed, 1 Mar 2023 20:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229759AbjCAUPj (ORCPT ); Wed, 1 Mar 2023 15:15:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbjCAUPa (ORCPT ); Wed, 1 Mar 2023 15:15:30 -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 5F908497D3 for ; Wed, 1 Mar 2023 12:15:18 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id p26so9365720wmc.4 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=h3oh8bAgj9/fmftkVuqmVhf3wNJO6a2AOceICkrklIftzHSJharLEutQsNVWFVnmdF 2sXf0VdXi3N0fx/igiy9qGQTBfpAvYcZMmlm3jOfva7pv/xtzkfm+R4wGgNAtKLv6Wqf URj92R8B0LKFkj3hM5SUpAAKWvHFtYf+JN7V9lEVomotcL36kFsqVnJWwObp6opdWuPn SSt5AUZC2yasyfgGuNTZ9bmGXj7X1+cF/Fgmox+8R+nA50zHkQNMRhoIVGvDRHi9AZdX ZK8CxoFvSsN2xGjrkStoEjZlcmPzQhxcRzVf4qgUwwUpc3CKmdbadq0YYTqXw5O3HndE HD9w== X-Gm-Message-State: AO0yUKVKNn0lrpgEGV44+ckmOk7mTfC1l3RPehF0nWEX33EcKNWV2eCH 61v8UjAj8P/LK7FIs4GcLcHuVA== 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?= =?utf-8?q?_S=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_S=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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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öderlund #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 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_thermal.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_thermal *data) static int amlogic_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { unsigned int tval; - struct amlogic_thermal *pdata = tz->devdata; + struct amlogic_thermal *pdata = thermal_zone_device_priv(tz); if (!pdata) return -EINVAL; diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.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_priv *priv, int *temp) static int armada_get_temp_legacy(struct thermal_zone_device *thermal, int *temp) { - struct armada_thermal_priv *priv = thermal->devdata; + struct armada_thermal_priv *priv = thermal_zone_device_priv(thermal); int ret; /* Valid check */ @@ -420,7 +420,7 @@ static struct thermal_zone_device_ops legacy_ops = { static int armada_get_temp(struct thermal_zone_device *tz, int *temp) { - struct armada_thermal_sensor *sensor = tz->devdata; + struct armada_thermal_sensor *sensor = thermal_zone_device_priv(tz); struct armada_thermal_priv *priv = sensor->priv; int ret; diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/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 { static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp) { - struct bcm2711_thermal_priv *priv = tz->devdata; + struct bcm2711_thermal_priv *priv = thermal_zone_device_priv(tz); int slope = thermal_zone_get_slope(tz); int offset = thermal_zone_get_offset(tz); u32 val; diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/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) static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct bcm2835_thermal_data *data = tz->devdata; + struct bcm2835_thermal_data *data = thermal_zone_device_priv(tz); u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT); if (!(val & BCM2835_TS_TSENSSTAT_VALID)) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/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, static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) { - struct brcmstb_thermal_priv *priv = tz->devdata; + struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); u32 val; long t; @@ -262,7 +262,7 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, void *data) static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct brcmstb_thermal_priv *priv = tz->devdata; + struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high); diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadcom/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 @@ static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - void __iomem *pvtmon = tz->devdata; + void __iomem *pvtmon = thermal_zone_device_priv(tz); int offset = thermal_zone_get_offset(tz); int slope = thermal_zone_get_slope(tz); u32 val; diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadcom/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 { static int sr_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sr_tmon *tmon = tz->devdata; + struct sr_tmon *tmon = thermal_zone_device_priv(tz); struct sr_thermal *sr_thermal = tmon->priv; *temp = readl(sr_thermal->regs + SR_TMON_TEMP_BASE(tmon->tmon_id)); diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.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 = z->devdata; + struct da9062_thermal *thermal = thermal_zone_device_priv(z); mutex_lock(&thermal->lock); *temp = thermal->temperature; diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.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 *temp) { - struct db8500_thermal_zone *th = tz->devdata; + struct db8500_thermal_zone *th = thermal_zone_device_priv(tz); /* * 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 *thermal, int *temp) { unsigned long reg; - struct dove_thermal_priv *priv = thermal->devdata; + struct dove_thermal_priv *priv = thermal_zone_device_priv(thermal); /* Valid check */ reg = 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_data *data) static int hisi_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct hisi_thermal_sensor *sensor = tz->devdata; + struct hisi_thermal_sensor *sensor = thermal_zone_device_priv(tz); struct hisi_thermal_data *data = sensor->data; *temp = data->ops->get_temp(sensor); diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.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) static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tmu_sensor *sensor = tz->devdata; + struct tmu_sensor *sensor = thermal_zone_device_priv(tz); struct imx8mm_tmu *tmu = sensor->priv; return tmu->socdata->get_temp(sensor, temp); diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.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_device *tz, int *temp) { struct imx_sc_msg_misc_get_temp msg; struct imx_sc_rpc_msg *hdr = &msg.hdr; - struct imx_sc_sensor *sensor = tz->devdata; + struct imx_sc_sensor *sensor = thermal_zone_device_priv(tz); int ret; msg.data.req.resource_id = 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, static int imx_get_temp(struct thermal_zone_device *tz, int *temp) { - struct imx_thermal_data *data = tz->devdata; + struct imx_thermal_data *data = thermal_zone_device_priv(tz); const struct thermal_soc_data *soc_data = data->socdata; struct regmap *map = 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 = tz->devdata; + struct imx_thermal_data *data = thermal_zone_device_priv(tz); if (mode == 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 = tz->devdata; + struct imx_thermal_data *data = thermal_zone_device_priv(tz); int ret; ret = pm_runtime_resume_and_get(data->dev); diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/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 = thermal->devdata; + struct int3400_thermal_priv *priv = thermal_zone_device_priv(thermal); int result = 0; 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 = zone->devdata; + struct int34x_thermal_zone *d = thermal_zone_device_priv(zone); unsigned long long tmp; acpi_status status; @@ -41,7 +41,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, int trip, int temp) { - struct int34x_thermal_zone *d = zone->devdata; + struct int34x_thermal_zone *d = thermal_zone_device_priv(zone); char name[] = {'P', 'A', 'T', '0' + trip, '\0'}; acpi_status status; 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, void *devid) static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) { - struct proc_thermal_pci *pci_info = tzd->devdata; + struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd); u32 _temp; 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) static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { - struct proc_thermal_pci *pci_info = tzd->devdata; + struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd); int tjmax, _temp; if (temp <= 0) { diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/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) static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp) { - struct pch_thermal_device *ptd = tzd->devdata; + struct pch_thermal_device *ptd = thermal_zone_device_priv(tzd); *temp = 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/thermal/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 = tzd->devdata; + struct soc_sensor_entry *aux_entry = thermal_zone_device_priv(tzd); int ret; ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, @@ -148,7 +148,7 @@ static int soc_dts_enable(struct thermal_zone_device *tzd) static int soc_dts_disable(struct thermal_zone_device *tzd) { u32 out; - struct soc_sensor_entry *aux_entry = tzd->devdata; + struct soc_sensor_entry *aux_entry = thermal_zone_device_priv(tzd); int ret; ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, @@ -250,7 +250,7 @@ static int update_trip_temp(struct soc_sensor_entry *aux_entry, static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { - return update_trip_temp(tzd->devdata, trip, temp); + return update_trip_temp(thermal_zone_device_priv(tzd), trip, temp); } 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/intel/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; - dts = tzd->devdata; + dts = thermal_zone_device_priv(tzd); sensors = dts->sensors; mutex_lock(&sensors->dts_update_lock); status = 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 = tzd->devdata; + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); struct intel_soc_dts_sensors *sensors = dts->sensors; int status; @@ -176,7 +176,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, return -EINVAL; mutex_lock(&sensors->dts_update_lock); - status = update_trip_temp(tzd->devdata, trip, temp, + status = update_trip_temp(dts, trip, temp, dts->trip_types[trip]); mutex_unlock(&sensors->dts_update_lock); @@ -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 = tzd->devdata; + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); *type = dts->trip_types[trip]; @@ -200,11 +198,10 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, { int status; u32 out; - struct intel_soc_dts_sensor_entry *dts; + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); struct intel_soc_dts_sensors *sensors; unsigned long raw; - dts = tzd->devdata; sensors = dts->sensors; status = 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(unsigned int cpu) static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) { - struct zone_device *zonedev = tzd->devdata; + struct zone_device *zonedev = thermal_zone_device_priv(tzd); int val; val = 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 = tzd->devdata; + struct zone_device *zonedev = thermal_zone_device_priv(tzd); u32 l, h, mask, shift, intr; int tj_max, ret; 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 *devdata, static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct k3_thermal_data *data = tz->devdata; + struct k3_thermal_data *data = thermal_zone_device_priv(tz); int ret = 0; ret = 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_data *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); } static const struct thermal_zone_device_ops k3_of_thermal_ops = { 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 = thermal->devdata; + struct kirkwood_thermal_priv *priv = thermal_zone_device_priv(thermal); reg = readl_relaxed(priv->sensor); 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 { static int max77620_thermal_read_temp(struct thermal_zone_device *tz, int *temp) { - struct max77620_therm_info *mtherm = tz->devdata; + struct max77620_therm_info *mtherm = thermal_zone_device_priv(tz); unsigned int val; int ret; diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/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_thermal_bank *bank) static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature) { - struct mtk_thermal *mt = tz->devdata; + struct mtk_thermal *mt = thermal_zone_device_priv(tz); int i; int tempmax = INT_MIN; diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/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) static int lvts_get_temp(struct thermal_zone_device *tz, int *temp) { - struct lvts_sensor *lvts_sensor = tz->devdata; + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz); void __iomem *msr = lvts_sensor->msr; u32 value; @@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp) static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct lvts_sensor *lvts_sensor = tz->devdata; + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz); void __iomem *base = lvts_sensor->base; u32 raw_low = lvts_temp_to_raw(low); u32 raw_high = lvts_temp_to_raw(high); diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/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) static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp) { - struct adc_tm5_channel *channel = tz->devdata; + struct adc_tm5_channel *channel = thermal_zone_device_priv(tz); int ret; if (!channel || !channel->iio) @@ -642,7 +642,7 @@ static int adc_tm5_gen2_configure(struct adc_tm5_channel *channel, int low, int static int adc_tm5_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct adc_tm5_channel *channel = tz->devdata; + struct adc_tm5_channel *channel = thermal_zone_device_priv(tz); struct adc_tm5_chip *chip; int ret; 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_chip *chip) static int qpnp_tm_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qpnp_tm_chip *chip = tz->devdata; + struct qpnp_tm_chip *chip = thermal_zone_device_priv(tz); int ret, mili_celsius; if (!temp) @@ -265,7 +265,7 @@ static int qpnp_tm_update_critical_trip_temp(struct qpnp_tm_chip *chip, static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_id, int temp) { - struct qpnp_tm_chip *chip = tz->devdata; + struct qpnp_tm_chip *chip = thermal_zone_device_priv(tz); struct thermal_trip trip; int ret; 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, void *data) static int tsens_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct tsens_sensor *s = tz->devdata; + struct tsens_sensor *s = thermal_zone_device_priv(tz); struct tsens_priv *priv = s->priv; struct device *dev = priv->dev; struct tsens_irq_data d; @@ -1057,7 +1057,7 @@ int __init init_common(struct tsens_priv *priv) static int tsens_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsens_sensor *s = tz->devdata; + struct tsens_sensor *s = thermal_zone_device_priv(tz); struct tsens_priv *priv = s->priv; return priv->ops->get_temp(s, temp); diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.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) static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qoriq_sensor *qsensor = tz->devdata; + struct qoriq_sensor *qsensor = thermal_zone_device_priv(tz); struct qoriq_tmu_data *qdata = qoriq_sensor_to_data(qsensor); u32 val; /* diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_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) static int rcar_gen3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct rcar_gen3_thermal_tsc *tsc = tz->devdata; + struct rcar_gen3_thermal_tsc *tsc = thermal_zone_device_priv(tz); int mcelsius, val; int reg; @@ -206,7 +206,7 @@ static int rcar_gen3_thermal_mcelsius_to_temp(struct rcar_gen3_thermal_tsc *tsc, static int rcar_gen3_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct rcar_gen3_thermal_tsc *tsc = tz->devdata; + struct rcar_gen3_thermal_tsc *tsc = thermal_zone_device_priv(tz); u32 irqmsk = 0; if (low != -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) #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_thermal_priv *priv, static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) { - struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); + struct rcar_thermal_priv *priv = thermal_zone_device_priv(zone); 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) static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct rockchip_thermal_sensor *sensor = tz->devdata; + struct rockchip_thermal_sensor *sensor = thermal_zone_device_priv(tz); struct rockchip_thermal_data *thermal = sensor->thermal; const struct rockchip_tsadc_chip *tsadc = thermal->chip; @@ -1226,7 +1226,7 @@ static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, i static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp) { - struct rockchip_thermal_sensor *sensor = tz->devdata; + struct rockchip_thermal_sensor *sensor = thermal_zone_device_priv(tz); struct rockchip_thermal_data *thermal = sensor->thermal; const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip; int retval; diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.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_thermal_priv *priv, u32 reg, static int rzg2l_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct rzg2l_thermal_priv *priv = tz->devdata; + struct rzg2l_thermal_priv *priv = thermal_zone_device_priv(tz); u32 result = 0, dsensor, ts_code_ave; int val, i; 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) static int exynos_get_temp(struct thermal_zone_device *tz, int *temp) { - struct exynos_tmu_data *data = tz->devdata; + struct exynos_tmu_data *data = thermal_zone_device_priv(tz); int value, ret = 0; if (!data || !data->tmu_read) @@ -723,7 +723,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data, static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp) { - struct exynos_tmu_data *data = tz->devdata; + struct exynos_tmu_data *data = thermal_zone_device_priv(tz); int ret = -EINVAL; if (data->soc == SOC_ARCH_EXYNOS4210) diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.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 = thermal->devdata; + struct spear_thermal_dev *stdev = thermal_zone_device_priv(thermal); /* * Data are ready to be read after 628 usec from POWERDOWN signal @@ -48,7 +48,7 @@ static struct thermal_zone_device_ops ops = { static int __maybe_unused spear_thermal_suspend(struct device *dev) { struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev); - struct spear_thermal_dev *stdev = spear_thermal->devdata; + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); unsigned int actual_mask = 0; /* Disable SPEAr Thermal Sensor */ @@ -64,7 +64,7 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev) static int __maybe_unused spear_thermal_resume(struct device *dev) { struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev); - struct spear_thermal_dev *stdev = spear_thermal->devdata; + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); unsigned int actual_mask = 0; int ret = 0; @@ -154,7 +154,7 @@ static int spear_thermal_exit(struct platform_device *pdev) { unsigned int actual_mask = 0; struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); - struct spear_thermal_dev *stdev = spear_thermal->devdata; + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); thermal_zone_device_unregister(spear_thermal); 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 sprd_thermal_sensor *sen) static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) { - struct sprd_thermal_sensor *sen = tz->devdata; + struct sprd_thermal_sensor *sen = thermal_zone_device_priv(tz); u32 data; data = readl(sen->data->base + SPRD_THM_TEMP(sen->id)) & diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.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_sensor *sensor) /* Callback to get temperature from HW*/ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature) { - struct st_thermal_sensor *sensor = th->devdata; + struct st_thermal_sensor *sensor = thermal_zone_device_priv(th); struct device *dev = sensor->dev; unsigned int temp; unsigned int overflow; diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.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 *sensor) static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct stm_thermal_sensor *sensor = tz->devdata; + struct stm_thermal_sensor *sensor = thermal_zone_device_priv(tz); u32 itr1, th; int ret; @@ -351,7 +351,7 @@ static int stm_thermal_set_trips(struct thermal_zone_device *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 = tz->devdata; + struct stm_thermal_sensor *sensor = thermal_zone_device_priv(tz); u32 periods; int freqM, ret; diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.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, static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsensor *s = tz->devdata; + struct tsensor *s = thermal_zone_device_priv(tz); struct ths_device *tmdev = s->tmdev; int val = 0; diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.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) static int tegra_thermctl_get_temp(struct thermal_zone_device *tz, int *out_temp) { - struct tegra_thermctl_zone *zone = tz->devdata; + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); u32 val; val = readl(zone->reg); @@ -584,7 +584,7 @@ static int tsensor_group_thermtrip_get(struct tegra_soctherm *ts, int id) static int tegra_thermctl_set_trip_temp(struct thermal_zone_device *tz, int trip_id, int temp) { - struct tegra_thermctl_zone *zone = tz->devdata; + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); struct tegra_soctherm *ts = zone->ts; struct thermal_trip trip; const struct tegra_tsensor_group *sg = zone->sg; @@ -658,7 +658,7 @@ static void thermal_irq_disable(struct tegra_thermctl_zone *zn) static int tegra_thermctl_set_trips(struct thermal_zone_device *tz, int lo, int hi) { - struct tegra_thermctl_zone *zone = tz->devdata; + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); u32 r; thermal_irq_disable(zone); diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/tegra/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_bpmp_thermal_zone *zone, 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 = thermal_zone_device_priv(tz); + + return __tegra_bpmp_thermal_get_temp(zone, out_temp); } static int tegra_bpmp_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct tegra_bpmp_thermal_zone *zone = tz->devdata; + struct tegra_bpmp_thermal_zone *zone = 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/tegra/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) static int tegra_tsensor_get_temp(struct thermal_zone_device *tz, int *temp) { - const struct tegra_tsensor_channel *tsc = tz->devdata; + const struct tegra_tsensor_channel *tsc = thermal_zone_device_priv(tz); const struct tegra_tsensor *ts = tsc->ts; int err, c1, c2, c3, c4, counter; u32 val; @@ -218,7 +218,7 @@ static int tegra_tsensor_temp_to_counter(const struct tegra_tsensor *ts, int tem static int tegra_tsensor_set_trips(struct thermal_zone_device *tz, int low, int high) { - const struct tegra_tsensor_channel *tsc = tz->devdata; + const struct tegra_tsensor_channel *tsc = thermal_zone_device_priv(tz); const struct tegra_tsensor *ts = tsc->ts; u32 val; diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-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_info *gti, int val) static int gadc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct gadc_thermal_info *gti = tz->devdata; + struct gadc_thermal_info *gti = thermal_zone_device_priv(tz); int val; int ret; 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, int *temp) { int t; - struct thermal_mmio *sensor = tz->devdata; + struct thermal_mmio *sensor = thermal_zone_device_priv(tz); t = sensor->read_mmio(sensor->mmio_base) & sensor->mask; t *= sensor->factor; diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/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, int s, int c) static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { struct thermal_zone_device *pcb_tz = NULL; - struct ti_thermal_data *data = tz->devdata; + struct ti_thermal_data *data = 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 static int __ti_thermal_get_trend(struct thermal_zone_device *tz, int trip, enum thermal_trend *trend) { - struct ti_thermal_data *data = tz->devdata; + struct ti_thermal_data *data = thermal_zone_device_priv(tz); struct ti_bandgap *bgp; int id, tr, ret = 0; 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) static int uniphier_tm_get_temp(struct thermal_zone_device *tz, int *out_temp) { - struct uniphier_tm_dev *tdev = tz->devdata; + struct uniphier_tm_dev *tdev = thermal_zone_device_priv(tz); struct regmap *map = tdev->regmap; int ret; u32 temp; From patchwork Wed Mar 1 20:14:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658035 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 47FEEC7EE23 for ; Wed, 1 Mar 2023 20:15:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbjCAUPw (ORCPT ); Wed, 1 Mar 2023 15:15:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbjCAUPs (ORCPT ); Wed, 1 Mar 2023 15:15:48 -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 10C204FA93 for ; Wed, 1 Mar 2023 12:15:24 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id az36so9394790wmb.1 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=vGXhumXdgxv6YBnkDXNbiXJnX2/hxvp4zKokhekuLkIaWoWL3x5lA8OGxjHIrRJSlE B1Royni17UmeH4Mb9haUQTihOOABQ5vGlDbvDUpTuDuGWEAEZNVh7O3liJTYr+XDdJr/ CDgQVIpDlyKUxlFHufgGEGGQVbE+aPCDtnoCFS6wzj94c/L31vmrYGOl3Anzv8JbHPAB kQIEY6P8ISbsJIln9AxLXsFi/SxbtGiG1JH2KEOtCPVewZ7u2JxqSKQuiwcRMd3UHzUM y1Ueh+o9uBJrf6uoJLw7H2HM6dmwLFmy8BV1PuAwctOJe3VtHQQuMcs3wEqTtm1DDsFi Iw5Q== X-Gm-Message-State: AO0yUKUetl3UwBuG7HW0XVVYR1ljV7XAB6j3jUI+p0oQTuGVdzhO8QTw +q+hz3WXizb1jDAa6POTUZu9ZA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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_helpers.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 = tz->emul_temperature; } + if (ret) + dev_dbg(&tz->device, "Failed to get temperature: %d\n", ret); + return ret; } From patchwork Wed Mar 1 20:14:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658034 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 F3889C7EE23 for ; Wed, 1 Mar 2023 20:16:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbjCAUQD (ORCPT ); Wed, 1 Mar 2023 15:16:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbjCAUPu (ORCPT ); Wed, 1 Mar 2023 15:15:50 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC81F4FABB for ; Wed, 1 Mar 2023 12:15:28 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id e13so2981179wro.10 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=gCDZJtYhe3cFsKLD99x5Wp9jic6LiWjGHAXIokVU0+vxOKdoSxBueTmIyA1geuS2pU r1Svqo7xIs/xHbE8V0ylGsYiEDU3nvcrLCBrZFwwjUz+Eip+drMh9arxszio2g4rRzOh 4PdwbC+C6JdiASvuMu85cbxVD0qMCaVtK1EKgemIsjhiqTYVsAIpEpcApp+/e/+G2ID0 BbYCSObfh+EIvQA0No+xuptsrKNcIfHnLRjJGU4pGEkeRP4L+S+JXYLZH0WAgaTUrs02 F4n+LQViTKgzmw5XwOWnsEDN0mdx+VWLqNQ/aE9ngw+1MGeG8pUpbhHmLRRbsnOoQJdD iO1g== X-Gm-Message-State: AO0yUKVeiof2/Eru0J4LEVQ/pDQw3zDzapJSpzBTbXglm2nH5uZm1gb9 UbaR+VdhJWkrgn4FjPaKQ6V1Aw== 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?= =?utf-8?q?_S=C3=B6derlund?= , Florian Fainelli , Amit Kucheria , Zhang Rui , Broadcom internal kernel review list , Ray Jui , Scott Branden , =?utf-8?q?Niklas_S=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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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öderlund #R-Car Signed-off-by: Daniel Lezcano Acked-by: Florian Fainelli #Broadcom --- 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/broadcom/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) priv->thermal = thermal; - thermal->tzp->no_hwmon = false; return thermal_add_hwmon_sysfs(thermal); } diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/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 = false; err = thermal_add_hwmon_sysfs(tz); if (err) goto err_tz; diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_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_device *pdev) } tsc->zone = zone; - tsc->zone->tzp->no_hwmon = false; ret = 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) } 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 = false; ret = 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_device *pdev) for (i = 0; i < thermal->chip->chn_num; i++) { rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); - thermal->sensors[i].tzd->tzp->no_hwmon = false; error = 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_thermal.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) } priv->zone = zone; - priv->zone->tzp->no_hwmon = false; ret = thermal_add_hwmon_sysfs(priv->zone); if (ret) goto err; From patchwork Wed Mar 1 20:14:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658033 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 A822AC7EE23 for ; Wed, 1 Mar 2023 20:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbjCAUQX (ORCPT ); Wed, 1 Mar 2023 15:16:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229809AbjCAUQR (ORCPT ); Wed, 1 Mar 2023 15:16:17 -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 35B78515E6 for ; Wed, 1 Mar 2023 12:15:40 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id j19-20020a05600c1c1300b003e9b564fae9so314089wms.2 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=DYYHNLc3deZ0MLAp845OE9U36yDiY+1Kr2hNbBeWZ7cdgqysx1Jmi1RZnJDA/zJBz9 qcP2HANrvR1m6epG/zjT0aIsE0c+I3q2C04RUDegJvb3W5xFdlYwOYdkJQHtNMOoRW3X Tk8w2nsBHzRka8z3ZCZMqWcgkcck9ys711E4S0S9DRgblpRqybv5tLLC7N+WF6oBgn+e IHRbnzmK2hN0B0godLAyHEZHq4TBzICYpOccvzi4hLaek6BpgvlQVbauIB3uu0hh6zPw fBQ6GdOm6+xtDZJ6y5ZAcAK63NSwfbagokRVu8Y9mej30oMPsPtsEy2Lq5Ltpi8pI+qk SeXQ== X-Gm-Message-State: AO0yUKUAK/a0551LrAh+QgFtPts7M8Vt+9h/RAafpeWGI6skiGzGbGLk 4w8YAVzCwudj+G9tLcozsYoXbw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 *tz, int *temp) if (data->alarm_temp == 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); } } if (*temp != data->last_temp) { - dev_dbg(&tz->device, "millicelsius: %d\n", *temp); + dev_dbg(data->dev, "millicelsius: %d\n", *temp); data->last_temp = *temp; } @@ -367,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, static int imx_bind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev) { - int ret; - - ret = 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); } static int imx_unbind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev) { - int ret; - - ret = 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); } static struct thermal_zone_device_ops imx_tz_ops = { @@ -558,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev) { struct imx_thermal_data *data = dev; - 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); thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED); diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/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 *tz, int low, int high) * 14-0 : Raw temperature for threshold */ if (low != -INT_MAX) { - dev_dbg(&tz->device, "Setting low limit temperature interrupt: %d\n", low); + pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, low); writel(raw_low, LVTS_H2NTHRE(base)); } @@ -318,7 +318,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * * 14-0 : Raw temperature for threshold */ - dev_dbg(&tz->device, "Setting high limit temperature interrupt: %d\n", high); + pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, high); writel(raw_high, LVTS_HTHRE(base)); return 0; diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.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_device *tz) hwmon = 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; } temp = 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; } diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/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) thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); - 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); } From patchwork Wed Mar 1 20:14:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658032 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 D1D30C7EE23 for ; Wed, 1 Mar 2023 20:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbjCAUQg (ORCPT ); Wed, 1 Mar 2023 15:16:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbjCAUQR (ORCPT ); Wed, 1 Mar 2023 15:16:17 -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 7D1C2497D3 for ; Wed, 1 Mar 2023 12:15:43 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id az36so9395192wmb.1 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=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=FYEKnVD02s12RjSPrAvepMS6ZY7M+LX39nLoVp37h2x7zrgkR5Ve6Ixxc75urMTnOp ZljMb87gcQar6HwA9A6eXhXpca3B9gCueFWdcL+cQeJrFGXbNvNugHx4lwJJM8DEGXgd pnlITPhPZyz0Ef0zbiIee1N5gQW+wfnZAWTPvbDJzvUwkSoxZmUvbuoUSOzB8n/1z2zE TlciraW06Jblt1ki/AQ+goDTu39mx/sOpENDQeC+rmXPAg06C+0lU1GlIBxVlKXBccho Goo+Uo2I3j4nAjQ2ktspvYR7gv+8hco9NZR5GPyMHTUtaLBvo2kALiJxwyC+0AhcpCRP YKUA== X-Gm-Message-State: AO0yUKWSCxgAixirST8vp7Y9AeBmv8P90mt+KFV/DHguZLouC9Hfy5uR gM9zD7/6MAhe8q1B3GZWna4Xmg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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_thermal.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) platform_set_drvdata(pdev, spear_thermal); - 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); return 0; From patchwork Wed Mar 1 20:14:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658031 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 60B52C7EE3A for ; Wed, 1 Mar 2023 20:16:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229962AbjCAUQl (ORCPT ); Wed, 1 Mar 2023 15:16:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230013AbjCAUQT (ORCPT ); Wed, 1 Mar 2023 15:16:19 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 811FB515E9 for ; Wed, 1 Mar 2023 12:15:53 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id j2so14483076wrh.9 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=vORSz6ywuv6n5z0oMQvjcVcTq0U5Xr3i64d1V/Ntvo27ri2xFTV0HWFhDCWnrmrbow LStIRnn3c6vILfsjGz3U4nNQUOazn4mRmq39EqrafT/yty8274/lW4ODEo7OHGBA4ymh 6EHrOwlV5euHVU2LSqyedA52t58nrjKKEfUnM5AXcghNjaudLD27Ztiow7eBuEVwpGZ8 NH4w/iG9qxDMJ7IcW9gmRR81D2vwhjPPHGA12WpHbLhQlOW2MJZA44nSoLa98AAcbk95 GRApbgGEy2HMTD+tlbN16k1JROl/QZb+qsDtEDdiv9Gl/O96sgIQOBvPrWNxkunlPKnN FKhA== X-Gm-Message-State: AO0yUKUS91acX6oGBepu7cRKQeb3i/GZhbkyIiKGLB7XG3dYK4uAyvoZ NZLEmH5waFFPLCs+WXSSnC647w== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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-thermal.c index e7097f354750..2d31b1f73423 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -41,6 +41,8 @@ #define DA9062_MILLI_CELSIUS(t) ((t) * 1000) +static unsigned int pp_tmp = 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 *work) thermal_zone_device_update(thermal->zone, THERMAL_EVENT_UNSPECIFIED); - delay = thermal->zone->passive_delay_jiffies; + /* + * pp_tmp is between 1s and 10s, so we can round the jiffies + */ + delay = 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 = dev_get_drvdata(pdev->dev.parent); struct da9062_thermal *thermal; - unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; const struct of_device_id *match; int ret = 0; @@ -208,8 +212,7 @@ static int da9062_thermal_probe(struct platform_device *pdev) } 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); ret = platform_get_irq_byname(pdev, "THERMAL"); if (ret < 0) From patchwork Wed Mar 1 20:14:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658030 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 3C459C678D4 for ; Wed, 1 Mar 2023 20:16:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230097AbjCAUQs (ORCPT ); Wed, 1 Mar 2023 15:16:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbjCAUQU (ORCPT ); Wed, 1 Mar 2023 15:16:20 -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 E3426515F4 for ; Wed, 1 Mar 2023 12:15:53 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id d41-20020a05600c4c2900b003e9e066550fso257466wmp.4 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=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=R8BlMxXxbFryIopsGAg6UYE+XFxKlpaLXDzbQZ9pydQQidX0VHsgTpEg00/VYPN++g EkKCDB9UL1bJNVEqHk7kOStDdnCRB1a8gkmRRUUlWdU21UK4CJMqB9laObNrXpBTIhZ4 sW4o1ujUqUFAv35yX9JGuN/ObTLavc3mM8wFwarRGG3DdltH3PBVs7d4jYR9QPMJF6b4 ZwolpP21folFZjespHAhis/MJXeoJqreX0Y+2HR1QXNZ0k6BbNDQvP2cs7RpCC/mOa+n qw4aoo6zRFZs+w+VBypUKHiZyjj8c+/mB44De2H+/V6eEAkLhPKOL+Ixve6q41lHvGsi 3gsw== X-Gm-Message-State: AO0yUKVRLM/rKBIhhqZN4kGUIfDr1KTlJ3NR8QOOBt7He92o3PyDcwzr 1j+wcj8CP0OqTnEoZo+W3aGwscm3c2yg9U5ZXx2efQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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_hwmon.c index bc02095b314c..c59db17dddd6 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -17,6 +17,7 @@ #include #include "thermal_hwmon.h" +#include "thermal_core.h" /* hwmon sys I/F */ /* thermal zone devices with the same type share one hwmon device */ From patchwork Wed Mar 1 20:14:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 658029 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 EA39AC7EE36 for ; Wed, 1 Mar 2023 20:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbjCAURA (ORCPT ); Wed, 1 Mar 2023 15:17:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229973AbjCAUQU (ORCPT ); Wed, 1 Mar 2023 15:16:20 -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 765B551F84 for ; Wed, 1 Mar 2023 12:15:57 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id p16so9366575wmq.5 for ; Wed, 01 Mar 2023 12:15:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701757; 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=OePQtLOGe7LDEC9FRQ7V9NVHHpJaS6nf3PuVfwUJDUS7IiBldmApsOZaHqqQCwCxXg QlNTNnxk3BjgSzbPhIksEuI6IXQmlfigT05KUDIUi77jL+mdq4OXGTO1jc/oRehRdFWD 1V5jTlEIfV45SPZE1nMmCKWE7PjZ/4J8jYkA+bKzuA//LRY9CtLMhzZbeB2bb3sieGaY AKGEBgvstFbgJI8VNqtqNh2LL9EtvGklrwrX/h2PmHSFSkbinhgUypa70/PUTTwUhAEm yKT3e6Mun+cowZXLiMHAqU+cHD1uN+BDHEZWDY0NQ0g5VECQSmxG6bR+qO5e1y4+x8Pm yIXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701757; 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=2DgG5IiYBi2Q3kcKBB5z/cbsHr4XT0vxMv9kX65Gu7H/BD6vdACguXLcz4PdXvXa5Y cUz0Xtogra2uehA5+nABNPiNkWNc3+uDxgrhJRL7Cm2ryPsHX5D6kbapg105shzOf/dl TKWiSaWgpYqr6JbWIYf4wEOIx4n5F7rvdEE8YsOjga5u8TeKtDkU32kpbmhgaJ+kJmiT oCmZRkJP0cjjvFCDcgnZWWps5IZ7LJXCy8XR15SV4mtOcE5sEMZCKhVkx6LulMsefY7/ +qw4rmQkkbt0bfCQYtMHQIz9SGjqidC5PUxjxm8v32ZCEckC2uYEqJTeEY/0uqFsIllV Gn/Q== X-Gm-Message-State: AO0yUKXbe71rOSaYusPS7SGThrgU3Juo8T8q8xU+mTgzTq0U2/ZsK8e6 g0745wdeoLeBuKTRNsGqEG/QBw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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; - if (strcmp(thz_dev->governor->name, - acerhdf_zone_params.governor_name)) { - pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n", - acerhdf_zone_params.governor_name); - return -EINVAL; - } - return 0; }