From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BC55C433E0 for ; Mon, 29 Jun 2020 21:43:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A15D206A1 for ; Mon, 29 Jun 2020 21:43:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=verdurent-com.20150623.gappssmtp.com header.i=@verdurent-com.20150623.gappssmtp.com header.b="yXWQZyxv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404000AbgF2Vnu (ORCPT ); Mon, 29 Jun 2020 17:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbgF2Shs (ORCPT ); Mon, 29 Jun 2020 14:37:48 -0400 Received: from mail-vs1-xe44.google.com (mail-vs1-xe44.google.com [IPv6:2607:f8b0:4864:20::e44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F77C00F839 for ; Mon, 29 Jun 2020 05:48:03 -0700 (PDT) Received: by mail-vs1-xe44.google.com with SMTP id x13so4411397vsx.13 for ; Mon, 29 Jun 2020 05:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sinEnS6z0XptgBEvEcK3MVQ+LTLUCuUM67IGB48+uOQ=; b=yXWQZyxv3Tuid2rMLdkiiqPqO771/LUhGpTuZO7tN1lCQvALpqAXD6QDLbcVJdR2DJ /NPqfsSrNnYOgvRHpQaNAZ4aqjyp4oHfKnfhjmq78WXV1756CXcVm/4dWP1AzJuA5/ox 7ywP5FU8VnODuq75PVQVtv6u5sRujs0EY8pIwLtzjNllqTpxdu6/FoOHTmQBWiC390jn Bcn1nz/GPyqqn5oBysRBz+SFvJwLZS7HNAF9/m+gIqbPsvCOfzMJIASBApYkdAR3eaU5 ogssMmkIDK2r6MXGaicZV0/WI5tfJ6n2VqmdQHmHpapNFZtQZ24bkM0owtL2IkL9jPv2 j2Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sinEnS6z0XptgBEvEcK3MVQ+LTLUCuUM67IGB48+uOQ=; b=pMbhe3+0diUPl1thyBt9Vj6gtcPBe7MQwrovQV6OCUWuhoZcxNRGd5c8lkqCnyFtN8 71UZq+O4a1Aae+wV2xabS8a41L4SmYDFwrK6R3SFbhs0pTBaxob8KmUa0skmoh9rFRDn 73vgNqhf2cDdc87VzB+UGzjw1IXRtTuqQ09KH2hXz/WfRNyP/xm6Nj4+v/7TrG3Q1fHf SDGxu01TZgSEo8qx8mEKgjQVfqpsLwe/t/679KvkxsJj7YuE/ceDRQ1W59hJ7RlME5Xi ktl+5PPGI2T3PqEQeU+qLQFFA1qC2TJZuJBrPUXmKTvvh64PuyXtweR42wXst6EQ0eg8 DlvA== X-Gm-Message-State: AOAM532OpOhofW7txiUQWpw2Ps6mzn/uxLqH40RGwJta3QYoZOu/qeBu qTCQpPW4bM2X2MVhXoRu/XkT1qw03VmaLMbsgKNiBA== X-Google-Smtp-Source: ABdhPJz5y4gYixUUu743AouZ4iPhyVkpUcLHjnbxyNRQtJI4Joc90JTCn7lsZ28Q7GeTrTlI2ZxCvGHDHBtVZEeY4WU= X-Received: by 2002:a67:7f04:: with SMTP id a4mr5835962vsd.9.1593434882284; Mon, 29 Jun 2020 05:48:02 -0700 (PDT) MIME-Version: 1.0 References: <20200629122925.21729-1-andrzej.p@collabora.com> <20200629122925.21729-11-andrzej.p@collabora.com> In-Reply-To: <20200629122925.21729-11-andrzej.p@collabora.com> From: Amit Kucheria Date: Mon, 29 Jun 2020 18:17:51 +0530 Message-ID: Subject: Re: [PATCH v7 10/11] thermal: Simplify or eliminate unnecessary set_mode() methods To: Andrzej Pietrasiewicz Cc: Linux PM list , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, platform-driver-x86@vger.kernel.org, lakml , linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, "Rafael J . Wysocki" , Len Brown , Vishal Kulkarni , "David S . Miller" , Jiri Pirko , Ido Schimmel , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , Peter Kaestle , Darren Hart , Andy Shevchenko , Sebastian Reichel , Miquel Raynal , Daniel Lezcano , Support Opensource , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Heiko Stuebner , Orson Zhai , Baolin Wang , Chunyan Zhang , Zhang Rui , Allison Randal , Enrico Weigelt , Gayatri Kammela , Thomas Gleixner , Bartlomiej Zolnierkiewicz , kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Mon, Jun 29, 2020 at 6:00 PM Andrzej Pietrasiewicz wrote: > > 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 Reviewed-by: Amit Kucheria > --- > 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, > -- > 2.17.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amit Kucheria Subject: Re: [PATCH v7 10/11] thermal: Simplify or eliminate unnecessary set_mode() methods Date: Mon, 29 Jun 2020 18:17:51 +0530 Message-ID: References: <20200629122925.21729-1-andrzej.p@collabora.com> <20200629122925.21729-11-andrzej.p@collabora.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <20200629122925.21729-11-andrzej.p@collabora.com> Sender: netdev-owner@vger.kernel.org To: Andrzej Pietrasiewicz Cc: Linux PM list , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, platform-driver-x86@vger.kernel.org, lakml , linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, "Rafael J . Wysocki" , Len Brown , Vishal Kulkarni , "David S . Miller" , Jiri Pirko , Ido Schimmel , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , Peter Kaestle , Darr List-Id: platform-driver-x86.vger.kernel.org On Mon, Jun 29, 2020 at 6:00 PM Andrzej Pietrasiewicz wrote: > > 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 Reviewed-by: Amit Kucheria > --- > 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, > -- > 2.17.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12A97C433DF for ; Mon, 29 Jun 2020 12:49:44 +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 BA60423D22 for ; Mon, 29 Jun 2020 12:49:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TGsNzuMD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=verdurent-com.20150623.gappssmtp.com header.i=@verdurent-com.20150623.gappssmtp.com header.b="yXWQZyxv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA60423D22 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=verdurent.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=G8JGxY26V+0FrBq+Ln7jkGt7cAF3gdvTmVhdlnbYmL4=; b=TGsNzuMDexqHPb+Kw1JZVoht6 FnlRIAEIMZnQ6xcMKRO/XVpyfpQR1F9x6JlhmLdjSnr8rby3/+7F8EhkLdehJoiYEI5Y+l5EDuUYS AdNUc7mXfJNz8l4TQt0JjGJt8I6PvAkjU96Y/feCDeIouC0p6QrHb9nCweaHtyiSW0xkHjcJCaxQE ocMRGbzow+f7g4d2wNKmOtE4J4/eDyhTH04HoPgWBV4bQFrmmj9WtWQR37cQBMCM3HQn6mYrnEkUp YdIkf+9wToYtq4jMbooQ0hdLfD1MESFD2OsHtRLGhzE3JozJHERWS1RcbtbU5mhi1bZuXmk4VLPKL Q73nfvI0Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jptCy-0001qC-DQ; Mon, 29 Jun 2020 12:48:24 +0000 Received: from mail-vs1-xe42.google.com ([2607:f8b0:4864:20::e42]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jptCd-0001j2-W4 for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:48:06 +0000 Received: by mail-vs1-xe42.google.com with SMTP id e15so9150218vsc.7 for ; Mon, 29 Jun 2020 05:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sinEnS6z0XptgBEvEcK3MVQ+LTLUCuUM67IGB48+uOQ=; b=yXWQZyxv3Tuid2rMLdkiiqPqO771/LUhGpTuZO7tN1lCQvALpqAXD6QDLbcVJdR2DJ /NPqfsSrNnYOgvRHpQaNAZ4aqjyp4oHfKnfhjmq78WXV1756CXcVm/4dWP1AzJuA5/ox 7ywP5FU8VnODuq75PVQVtv6u5sRujs0EY8pIwLtzjNllqTpxdu6/FoOHTmQBWiC390jn Bcn1nz/GPyqqn5oBysRBz+SFvJwLZS7HNAF9/m+gIqbPsvCOfzMJIASBApYkdAR3eaU5 ogssMmkIDK2r6MXGaicZV0/WI5tfJ6n2VqmdQHmHpapNFZtQZ24bkM0owtL2IkL9jPv2 j2Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sinEnS6z0XptgBEvEcK3MVQ+LTLUCuUM67IGB48+uOQ=; b=ABtdoxbqT/cmZ3LI/g1xWzKVsSxMoi8GYpG3S6gyZlar3X6xOfmS8d8OUIdmXKgKxo oqbc2NB8A4o/0uYji6EW81dEVgHRyMk1UC+ft9Mm+OF/nwGCK9LaS9yh23C2vb2zE1FV JqlnKYyJYDhXvQzvR43LuMBHNs2KoUueIpHiKJXlC7rbSxRJRNBCpAiHGdb/WbM0ENs3 9o5shNea/6noAq5iV6ETESRYY0juAGPwwu/phStMAdxNe3i/m0Ss1eYBmi0C57YVeTuT bY+9iD5DQTVFBAhfz0a+TmE+IOBCbXthExr45KbQ/BBZmG1ljZmLHTrD2Ix/W9qUDFNw w7qA== X-Gm-Message-State: AOAM532VAwtkJMKwS/dS4mNIPerdvHK6UuZfYjBSPQnbr3kwe1iIGPfT 8okQ1I+hT6DO4ehkbxNUw0ED4SHhEjnvFrsaLxa9ug== X-Google-Smtp-Source: ABdhPJz5y4gYixUUu743AouZ4iPhyVkpUcLHjnbxyNRQtJI4Joc90JTCn7lsZ28Q7GeTrTlI2ZxCvGHDHBtVZEeY4WU= X-Received: by 2002:a67:7f04:: with SMTP id a4mr5835962vsd.9.1593434882284; Mon, 29 Jun 2020 05:48:02 -0700 (PDT) MIME-Version: 1.0 References: <20200629122925.21729-1-andrzej.p@collabora.com> <20200629122925.21729-11-andrzej.p@collabora.com> In-Reply-To: <20200629122925.21729-11-andrzej.p@collabora.com> From: Amit Kucheria Date: Mon, 29 Jun 2020 18:17:51 +0530 Message-ID: Subject: Re: [PATCH v7 10/11] thermal: Simplify or eliminate unnecessary set_mode() methods To: Andrzej Pietrasiewicz X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach , Heiko Stuebner , Peter Kaestle , platform-driver-x86@vger.kernel.org, Vishal Kulkarni , Luca Coelho , Miquel Raynal , kernel@collabora.com, Fabio Estevam , linux-rockchip@lists.infradead.org, Chunyan Zhang , Intel Linux Wireless , Allison Randal , NXP Linux Team , linux-acpi@vger.kernel.org, lakml , Darren Hart , Zhang Rui , Gayatri Kammela , Len Brown , Johannes Berg , Linux PM list , Sascha Hauer , Ido Schimmel , Baolin Wang , Jiri Pirko , Orson Zhai , Thomas Gleixner , Kalle Valo , Support Opensource , Enrico Weigelt , Daniel Lezcano , netdev@vger.kernel.org, "Rafael J . Wysocki" , Sebastian Reichel , linux-renesas-soc@vger.kernel.org, Bartlomiej Zolnierkiewicz , Pengutronix Kernel Team , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Shawn Guo , "David S . Miller" , Andy Shevchenko Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 29, 2020 at 6:00 PM Andrzej Pietrasiewicz wrote: > > 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 Reviewed-by: Amit Kucheria > --- > 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, > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel