From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam01on0116.outbound.protection.outlook.com ([104.47.32.116]:8864 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726000AbeITI2f (ORCPT ); Thu, 20 Sep 2018 04:28:35 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Anson Huang , Eduardo Valentin , Sasha Levin Subject: [PATCH AUTOSEL 4.18 08/56] thermal: of-thermal: disable passive polling when thermal zone is disabled Date: Thu, 20 Sep 2018 02:47:31 +0000 Message-ID: <20180920024716.58490-8-alexander.levin@microsoft.com> References: <20180920024716.58490-1-alexander.levin@microsoft.com> In-Reply-To: <20180920024716.58490-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Anson Huang [ Upstream commit 152395fd03d4ce1e535a75cdbf58105e50587611 ] When thermal zone is in passive mode, disabling its mode from sysfs is NOT taking effect at all, it is still polling the temperature of the disabled thermal zone and handling all thermal trips, it makes user confused. The disabling operation should disable the thermal zone behavior completely, for both active and passive mode, this patch clears the passive_delay when thermal zone is disabled and restores it when it is enabled. Signed-off-by: Anson Huang Signed-off-by: Eduardo Valentin Signed-off-by: Sasha Levin --- drivers/thermal/of-thermal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 977a8307fbb1..4f2816559205 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -260,10 +260,13 @@ static int of_thermal_set_mode(struct thermal_zone_de= vice *tz, =20 mutex_lock(&tz->lock); =20 - if (mode =3D=3D THERMAL_DEVICE_ENABLED) + if (mode =3D=3D THERMAL_DEVICE_ENABLED) { tz->polling_delay =3D data->polling_delay; - else + tz->passive_delay =3D data->passive_delay; + } else { tz->polling_delay =3D 0; + tz->passive_delay =3D 0; + } =20 mutex_unlock(&tz->lock); =20 --=20 2.17.1