From patchwork Mon Jun 29 11:16:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Pietrasiewicz X-Patchwork-Id: 11630713 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D25B739 for ; Mon, 29 Jun 2020 11:18:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66B7423A32 for ; Mon, 29 Jun 2020 11:18:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OEU1DPSY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66B7423A32 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SD+pQerVy7ZSqKmmZa8Od5dHgBaulQYK9wz2/d3e21E=; b=OEU1DPSY+IlJUAM98DywpVFA4n 3czbESqZ/t14dC3wjr7DW6hiKWChugtm+R9xSu1L5mm3WxXWi/DLSTM0vRyQQMMoR76rFddrtPFuZ dRLNgWU+eKQEGP7eONT/f+bH3naABZaTp0NRrU5sAUnN2I/jD1YNM455FM+ZHiH1BZz+l8oEpDg12 urJLg/lm6t9TM4vZ0O0Rp1riAKyros4a87jKzMIBDxyBPyJDwsTeKOMsPowIa40iPKlGkezqCsgm+ 1GuAdauRe+r862aivEvfSiX2DnB6h041Dxtfwj0V8sSZNslha/w4zm6kYM1onhUjQGoBH/y2nWT5/ TGpboHxA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprnv-0005I0-VJ; Mon, 29 Jun 2020 11:18:28 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprmG-0004U3-FP; Mon, 29 Jun 2020 11:16:50 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id B6A0A2A21C5 From: Andrzej Pietrasiewicz To: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH v6 10/11] thermal: Simplify or eliminate unnecessary set_mode() methods Date: Mon, 29 Jun 2020 13:16:14 +0200 Message-Id: <20200629111615.18131-11-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629111615.18131-1-andrzej.p@collabora.com> References: <20200629111615.18131-1-andrzej.p@collabora.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emmanuel Grumbach , Heiko Stuebner , "Rafael J . Wysocki" , Vishal Kulkarni , Luca Coelho , Miquel Raynal , kernel@collabora.com, Fabio Estevam , Amit Kucheria , Chunyan Zhang , Daniel Lezcano , Allison Randal , NXP Linux Team , Darren Hart , Zhang Rui , Gayatri Kammela , Len Brown , Johannes Berg , Intel Linux Wireless , Sascha Hauer , Ido Schimmel , Baolin Wang , Jiri Pirko , Orson Zhai , Thomas Gleixner , Kalle Valo , Support Opensource , Enrico Weigelt , Peter Kaestle , Sebastian Reichel , Andrzej Pietrasiewicz , Bartlomiej Zolnierkiewicz , Pengutronix Kernel Team , =?utf-8?q?Niklas_S=C3=B6de?= =?utf-8?q?rlund?= , Shawn Guo , "David S . Miller" , Andy Shevchenko MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Setting polling_delay is now done at thermal_core level (by not polling DISABLED devices), so no need to repeat this code. int340x: Checking for an impossible enum value is unnecessary. acpi/thermal: It only prints debug messages. Signed-off-by: Andrzej Pietrasiewicz [for acerhdf] Acked-by: Peter Kaestle Reviewed-by: Bartlomiej Zolnierkiewicz --- drivers/acpi/thermal.c | 26 ---------------- .../ethernet/mellanox/mlxsw/core_thermal.c | 30 ------------------- drivers/platform/x86/acerhdf.c | 3 -- drivers/thermal/imx_thermal.c | 6 ---- .../intel/int340x_thermal/int3400_thermal.c | 4 --- drivers/thermal/thermal_of.c | 18 ----------- 6 files changed, 87 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 52b6cda1bcc3..29a2b73fe035 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -525,31 +525,6 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) return 0; } -static int thermal_set_mode(struct thermal_zone_device *thermal, - enum thermal_device_mode mode) -{ - struct acpi_thermal *tz = thermal->devdata; - - if (!tz) - return -EINVAL; - - if (mode != THERMAL_DEVICE_DISABLED && - mode != THERMAL_DEVICE_ENABLED) - return -EINVAL; - /* - * enable/disable thermal management from ACPI thermal driver - */ - if (mode == THERMAL_DEVICE_DISABLED) - pr_warn("thermal zone will be disabled\n"); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "%s kernel ACPI thermal control\n", - mode == THERMAL_DEVICE_ENABLED ? - "Enable" : "Disable")); - - return 0; -} - static int thermal_get_trip_type(struct thermal_zone_device *thermal, int trip, enum thermal_trip_type *type) { @@ -836,7 +811,6 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { .bind = acpi_thermal_bind_cooling_device, .unbind = acpi_thermal_unbind_cooling_device, .get_temp = thermal_get_temp, - .set_mode = thermal_set_mode, .get_trip_type = thermal_get_trip_type, .get_trip_temp = thermal_get_trip_temp, .get_crit_temp = thermal_get_crit_temp, diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c index 4fb73d0fd167..8fa286ccdd6b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -275,19 +275,6 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev, return 0; } -static int mlxsw_thermal_set_mode(struct thermal_zone_device *tzdev, - enum thermal_device_mode mode) -{ - struct mlxsw_thermal *thermal = tzdev->devdata; - - if (mode == THERMAL_DEVICE_ENABLED) - tzdev->polling_delay = thermal->polling_delay; - else - tzdev->polling_delay = 0; - - return 0; -} - static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev, int *p_temp) { @@ -387,7 +374,6 @@ static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev, static struct thermal_zone_device_ops mlxsw_thermal_ops = { .bind = mlxsw_thermal_bind, .unbind = mlxsw_thermal_unbind, - .set_mode = mlxsw_thermal_set_mode, .get_temp = mlxsw_thermal_get_temp, .get_trip_type = mlxsw_thermal_get_trip_type, .get_trip_temp = mlxsw_thermal_get_trip_temp, @@ -445,20 +431,6 @@ static int mlxsw_thermal_module_unbind(struct thermal_zone_device *tzdev, return err; } -static int mlxsw_thermal_module_mode_set(struct thermal_zone_device *tzdev, - enum thermal_device_mode mode) -{ - struct mlxsw_thermal_module *tz = tzdev->devdata; - struct mlxsw_thermal *thermal = tz->parent; - - if (mode == THERMAL_DEVICE_ENABLED) - tzdev->polling_delay = thermal->polling_delay; - else - tzdev->polling_delay = 0; - - return 0; -} - static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev, int *p_temp) { @@ -574,7 +546,6 @@ static int mlxsw_thermal_module_trend_get(struct thermal_zone_device *tzdev, static struct thermal_zone_device_ops mlxsw_thermal_module_ops = { .bind = mlxsw_thermal_module_bind, .unbind = mlxsw_thermal_module_unbind, - .set_mode = mlxsw_thermal_module_mode_set, .get_temp = mlxsw_thermal_module_temp_get, .get_trip_type = mlxsw_thermal_module_trip_type_get, .get_trip_temp = mlxsw_thermal_module_trip_temp_get, @@ -612,7 +583,6 @@ static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev, static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = { .bind = mlxsw_thermal_module_bind, .unbind = mlxsw_thermal_module_unbind, - .set_mode = mlxsw_thermal_module_mode_set, .get_temp = mlxsw_thermal_gearbox_temp_get, .get_trip_type = mlxsw_thermal_module_trip_type_get, .get_trip_temp = mlxsw_thermal_module_trip_temp_get, diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 8fe0ecb6a626..76323855c80c 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -397,8 +397,6 @@ static inline void acerhdf_revert_to_bios_mode(void) { acerhdf_change_fanstate(ACERHDF_FAN_AUTO); kernelmode = 0; - if (thz_dev) - thz_dev->polling_delay = 0; pr_notice("kernel mode fan control OFF\n"); } @@ -406,7 +404,6 @@ static inline void acerhdf_enable_kernelmode(void) { kernelmode = 1; - thz_dev->polling_delay = interval*1000; pr_notice("kernel mode fan control ON\n"); } diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 53abb1be1cba..a02398118d88 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -338,9 +338,6 @@ static int imx_set_mode(struct thermal_zone_device *tz, const struct thermal_soc_data *soc_data = data->socdata; if (mode == THERMAL_DEVICE_ENABLED) { - tz->polling_delay = IMX_POLLING_DELAY; - tz->passive_delay = IMX_PASSIVE_DELAY; - regmap_write(map, soc_data->sensor_ctrl + REG_CLR, soc_data->power_down_mask); regmap_write(map, soc_data->sensor_ctrl + REG_SET, @@ -356,9 +353,6 @@ static int imx_set_mode(struct thermal_zone_device *tz, regmap_write(map, soc_data->sensor_ctrl + REG_SET, soc_data->power_down_mask); - tz->polling_delay = 0; - tz->passive_delay = 0; - if (data->irq_enabled) { disable_irq(data->irq); data->irq_enabled = false; diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 3c0397a29b8c..ce49d3b100d5 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -386,10 +386,6 @@ static int int3400_thermal_set_mode(struct thermal_zone_device *thermal, if (!priv) return -EINVAL; - if (mode != THERMAL_DEVICE_ENABLED && - mode != THERMAL_DEVICE_DISABLED) - return -EINVAL; - if (mode != thermal->mode) result = int3400_thermal_run_osc(priv->adev->handle, priv->current_uuid_index, diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 43a516a35d64..69ef12f852b7 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -267,22 +267,6 @@ static int of_thermal_unbind(struct thermal_zone_device *thermal, return 0; } -static int of_thermal_set_mode(struct thermal_zone_device *tz, - enum thermal_device_mode mode) -{ - struct __thermal_zone *data = tz->devdata; - - if (mode == THERMAL_DEVICE_ENABLED) { - tz->polling_delay = data->polling_delay; - tz->passive_delay = data->passive_delay; - } else { - tz->polling_delay = 0; - tz->passive_delay = 0; - } - - return 0; -} - static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, enum thermal_trip_type *type) { @@ -374,8 +358,6 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, } static struct thermal_zone_device_ops of_thermal_ops = { - .set_mode = of_thermal_set_mode, - .get_trip_type = of_thermal_get_trip_type, .get_trip_temp = of_thermal_get_trip_temp, .set_trip_temp = of_thermal_set_trip_temp,