Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2683357imj; Mon, 11 Feb 2019 07:00:15 -0800 (PST) X-Google-Smtp-Source: AHgI3IZFON+Qjl6KDRd62xPEvyH5nnkM6jUTGgjuSzDQ/SM0QH4dUc2pPOdgxj4lwEI1AH+dbMlz X-Received: by 2002:a63:ce08:: with SMTP id y8mr28826303pgf.388.1549897215492; Mon, 11 Feb 2019 07:00:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897215; cv=none; d=google.com; s=arc-20160816; b=k8AReWJYMTMBFX9DEMdU730UqxQjt3LNALY5yjPWiTpsiBqE+W4PJjfNS1xzTZyi3Y xv1Ua89U05Pe/p6hSWCWBMjgKZrA3HtgTCkTohbDuQiRVS7wRK9P9vmuh5Q9SGRUzBIC fnZiIi8iAYS5FjmfXaWeslV5Yyxg3MNY08XsTNhT4AUxdiQDopTQuqgrJMq0TpNPL4UQ Q0JmRe/T8XNIanO1TpXTVR5Q5Yhzh2Peqc66ST/sSqwyWdpKdRM1T45Ja9yQpX9x9XOs B5aqe4jWahh1ZD//GgE/mDiQsyHQcdWjZdS71jauR0hcL8GsXAcxB3Cf+EpPeWRUeDM4 SR6g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+47EznMU6EJlTY4nqyIcuOsGXF5C2rTF0/uKvLWLT0s=; b=EEfSI8Mxx7XT1gZlYkf05h9v8oiwHvceEBB15iJSpwNf7EF4r74mHGQPd6C37sWcpn uOhGfiTlxDP4HHsl3AOk3Nhtd1tP/vPpYa68HXZICE9poURPR7kvuMpKHqUWTxRuiB52 Y9fJ5qGzj4uiWgUwzekSqJeOlRED1/As+2JMqafq9gDK1lGWYzkfX4H0/jNU0e9EpWds SxXEKlNyPMEHIX2gEyEp5rFTiQEx8K++Wi9pSpBK6QgpSfQd/D/G1oQnU1bztuxUghXo Cv0ZgHWEPB5iUkki/yBD8T3L5TcGtHrWjko4iQsnrrfoV+dlJV2WtAyAo3ZMJw9rkZLN kt3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="06FWDz/q"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d32si10516953pla.136.2019.02.11.06.59.57; Mon, 11 Feb 2019 07:00:15 -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="06FWDz/q"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389433AbfBKO5v (ORCPT + 99 others); Mon, 11 Feb 2019 09:57:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:45320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389424AbfBKO5t (ORCPT ); Mon, 11 Feb 2019 09:57:49 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 847E62229E; Mon, 11 Feb 2019 14:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897069; bh=pZ0Um6vQZc42lec10/Sbv41j7sZ7qO0l8fcdkBnoiVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=06FWDz/q2OAIeat77Hl5/joU7hPCuosPdUeh8XvA3yxTJXXY/tfprIB3XKDzQ2Ea1 1rIdmxSgPnjz1VVKKnNG1oZTUArc9iVr26xnV9IC4ZiQMfT8HAzh4HAsSYKL6ppg24 8YcHAdcwXQFLZUCowgBorCNLqR3FM9F3ZeJ8OkRE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kame Wang , Wei Wang , Zhang Rui , Sasha Levin Subject: [PATCH 4.14 053/205] Thermal: do not clear passive state during system sleep Date: Mon, 11 Feb 2019 15:17:31 +0100 Message-Id: <20190211141832.303143315@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 2b1b0ba393a4..17d6079c7642 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -454,16 +454,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) { @@ -1503,7 +1507,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