Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3626932imu; Mon, 28 Jan 2019 08:04:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN7ycBriiTUBCdWV+nmi1vW/OVW9pWm4txbkSWKC5Y/ntP9zMm3MclGuDXwORZ5LTlyJNtJt X-Received: by 2002:a17:902:e10a:: with SMTP id cc10mr22647614plb.165.1548691480545; Mon, 28 Jan 2019 08:04:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691480; cv=none; d=google.com; s=arc-20160816; b=MaE6XN8rNG9TVtfIAGXnBwDCmWpxSVvOiybUlCVf1v/WEKSRjwfNbow35eq3FoNAD0 Bp9tctXem0P+kd+08ML7T7XqySedeDiaPaSqYIhCg9Pa+Pm/JT9T0ltn5mleZSA8Ylbi ZFeMKiHqzmtohowoYzl5AFRqN+WFOKP2pmP0gRwNTv91qfnMzjob7XiyIiHGQOylPfBi dHmYJbrnga+G9Ye25u3AJr7mXdLRCrKWMgdhDsjdkQFpo9mRbtBmDq34XuTpWoY3Vy+z TNQlYjepG44FmH+ULpX7YVexlzVeE0gjsTOJdqeBS+QM45U9Uqwmy5tEtuGvSar6QiW2 FzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HKBQxMoPBnLDizwhZGxPZavLDwb/QPwi6ajtp7zD2a4=; b=pUgP2w2kWDBLuqjomANaNyH2q8PmnglLoiLgGTxfS57EWZLrd5/igPcbJ7GIWBddLa s9UxN7rpsTN6X4XUERsRNqntO68PMepkAZsqx6wGkyv3AtvN5tRFxneS4V8CzZqL2+YQ 4Yq8kAlxShNTsH1XVDfniDocgvtjLoBhzZJWm+e/+3nwLe4zS5Hxeehit7HyTPhRQ2DQ Sxn6/Dyo3eNd5hkKaVeGOXqX6wM8on8VMTELpf7V9s8gGlldMuvY6UZd+zeIn63G8nNB szAKIBBnmiuySMfyLlrD1FvwlceUUen50ZfHmQ8x8YXtCvKbkNxeb0sAiOZFQAS4Uokf WM1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bBoFUDW6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15si14125420pgt.498.2019.01.28.08.04.24; Mon, 28 Jan 2019 08:04:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bBoFUDW6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731419AbfA1QDd (ORCPT + 99 others); Mon, 28 Jan 2019 11:03:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:48854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730735AbfA1QDa (ORCPT ); Mon, 28 Jan 2019 11:03:30 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0CC0B21848; Mon, 28 Jan 2019 16:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691410; bh=V0CaJN7T0D2iu6KZK5LLF1jwE5Bcs86VET2HD6ZUnlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bBoFUDW6tyykwc4X9oV5jEuDRNSvxa0HMmVYfiI2SQErvpgw6qscztPXGEva+oCn9 GHcRzoL5/+FCkiILk7FlEVcRxIPaR2mvl88MX5b5779T0qaKVxO6FoTGcEROCE4x1U poD8AM4YiZMCZVm3u6FtiKQmgfj2hKTrL4R02N+8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wei Wang , Zhang Rui , Sasha Levin , linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 086/258] Thermal: do not clear passive state during system sleep Date: Mon, 28 Jan 2019 10:56:32 -0500 Message-Id: <20190128155924.51521-86-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wei Wang [ Upstream commit 964f4843a455d2ffb199512b08be8d5f077c4cac ] commit ff140fea847e ("Thermal: handle thermal zone device properly during system sleep") added PM hook to call thermal zone reset during sleep. However resetting thermal zone will also clear the passive state and thus cancel the polling queue which leads the passive cooling device state not being cleared properly after sleep. thermal_pm_notify => thermal_zone_device_reset set passive to 0 thermal_zone_trip_update will skip update passive as `old_target == instance->target'. monitor_thermal_zone => thermal_zone_device_set_polling will cancel tz->poll_queue, so the cooling device state will not be changed afterwards. Reported-by: Kame Wang Signed-off-by: Wei Wang Signed-off-by: Zhang Rui Signed-off-by: Sasha Levin --- drivers/thermal/thermal_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 441778100887..bf9721fc2824 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -451,16 +451,20 @@ static void update_temperature(struct thermal_zone_device *tz) tz->last_temperature, tz->temperature); } -static void thermal_zone_device_reset(struct thermal_zone_device *tz) +static void thermal_zone_device_init(struct thermal_zone_device *tz) { struct thermal_instance *pos; - tz->temperature = THERMAL_TEMP_INVALID; - tz->passive = 0; list_for_each_entry(pos, &tz->thermal_instances, tz_node) pos->initialized = false; } +static void thermal_zone_device_reset(struct thermal_zone_device *tz) +{ + tz->passive = 0; + thermal_zone_device_init(tz); +} + void thermal_zone_device_update(struct thermal_zone_device *tz, enum thermal_notify_event event) { @@ -1502,7 +1506,7 @@ static int thermal_pm_notify(struct notifier_block *nb, case PM_POST_SUSPEND: atomic_set(&in_suspend, 0); list_for_each_entry(tz, &thermal_tz_list, node) { - thermal_zone_device_reset(tz); + thermal_zone_device_init(tz); thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); } -- 2.19.1