Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3379890yba; Tue, 16 Apr 2019 10:09:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyalQcQdRJR2oYtzX6S4dwipjr8dBjqO4TUTO1OQ4JyxfLfPNFN+ksTvMcldtgCJpy/G+zM X-Received: by 2002:a63:5a4b:: with SMTP id k11mr43010768pgm.119.1555434555858; Tue, 16 Apr 2019 10:09:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555434555; cv=none; d=google.com; s=arc-20160816; b=wz80kbZ8kqot/3TsIMB6zoppkRDJzk/eSDkJyI6/R1U9a/AcRDrmUguBAmoiGX4laG RO1YlvBMLw47XlCsbkOf9s6oC75vR9nlOgwTHOQ4NcNiclBHEwdhz21copE/IzrP5wYJ rSwvrl7LybDtfaClyCqMIn6K1A0CaOQaCPNs1AvjLFMygcC9P6m0zHS/r763aMTnLsUm Y6Deo26qUZZ+6sEDD2ly+OwRjBMVqaNNkK9AaOXEbUf0BHpepVPGvGC2hYtGy+SlQ3Ml RQWbcXWL9roRxn7LMoOX+2WJRDV5Ex2UzpOz6b7jdZrr1mQcXxDNU+616ijZwqb8RJyy b1Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:cc:from:subject:mime-version :message-id:date:dkim-signature; bh=4Xb9r78wtIVQzgmRj/VCgw4LZC1bfVVf3fvkPEzLd58=; b=DMXlrtljab2FmFh/PT1tnbQINd3AxXKwHe8gQ2GLD67sWKl8/uSx3nZ/lnL9twZvYL GBjZx7aTEds1isOMM5frkyiXRFzvhsa+cGsCmpSZbtSJNRlivsRb7KOdxV4t8aFBHkf1 3ikOuuUkvrFUWS3xyjAIiU2RmvB0kvkXkBzHbquL3DOtABYiHSFXmTp7hFyisHAHCguB 3ALNH16GEmx9c0zEnmoNkzsAOr2CaYYVKomYY1TIAet5Me9HhSZxfNuvxGYeIEl16/OY 2uu7w3BQ7twsvqIlxpzA0xpY+2yyzhi4uWvQvYAzeiQ1bSN/rGWZUWUBwMcJI6EyT3nH OTRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=awmgR1Sq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y193si13778511pgd.483.2019.04.16.10.08.59; Tue, 16 Apr 2019 10:09:15 -0700 (PDT) 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=@google.com header.s=20161025 header.b=awmgR1Sq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728764AbfDPRHG (ORCPT + 99 others); Tue, 16 Apr 2019 13:07:06 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:33568 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbfDPRHG (ORCPT ); Tue, 16 Apr 2019 13:07:06 -0400 Received: by mail-pg1-f202.google.com with SMTP id z14so12963142pgv.0 for ; Tue, 16 Apr 2019 10:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:cc; bh=4Xb9r78wtIVQzgmRj/VCgw4LZC1bfVVf3fvkPEzLd58=; b=awmgR1SqRft96tF11fLis6fySJvqzKmNhUU819y72B0Uc/AXwrgcSzgUS3d433pf7r Gs8y6uUypBao06/6SFdepc+TrlHh6BIrVPIhomcLccrDjZMVZJOatfdPC5U0p+uuT1nP HU5+QOTw02RV+amffH9xg4bQg2rKR1kDumUv7qVGK+Qib1Lxji/MAAOSvO5vQMafVc4p wOfUGB583jCBi2Q1487B/zOfTR/2yBQOTTO2Yt3td/NqvRMtdeB1DZxpGUwGIFaznfr0 AxOTO9180WBZStmOrp+Ta+GVEBq1xMHOOmpOxVvxDdSu3av1u9zM/QoT9BTVTjLm3h89 b/Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:cc; bh=4Xb9r78wtIVQzgmRj/VCgw4LZC1bfVVf3fvkPEzLd58=; b=UAsBRtrdXUzLlmAl6bYJnM9dN7hHiXtAfLvb46tlxl/CJkyNXyGHNeF1FhYddrLbe+ XHSMNpAR6lsSeJl8z1YitHUPz92XUiMNlkPj7H1jwDdeZFVMiH2JIncT6bzk4oUB8S+J iLhvmvIGujFkwVnpMou6sgrmJwYJ+AL0Gf7aCmFpTG3VHn9Upe8RmSZqzsHLmHw6frZJ 5nvZFa+rh8MQ+9RszTEpf5ebs5fUaDKW7x1vejGOx6EOTNGDIrnol0R/er48tVKeqFwD 1mj27IA4VeEtfUGR9xheR+lLuEQscOlml0HWdpBPBvdA5vzt9V/H0rgOIE0EVT6tWWNv hf0Q== X-Gm-Message-State: APjAAAUIbdtlhEbSWk20k8gi6ovrN7BFz5Dh6Zk4aJXfK4RUlqhi1F6d Q0Br2aTZMp3xXd9g4y3Hu27gMOA= X-Received: by 2002:a63:2356:: with SMTP id u22mr1748062pgm.2.1555434425401; Tue, 16 Apr 2019 10:07:05 -0700 (PDT) Date: Tue, 16 Apr 2019 10:07:01 -0700 Message-Id: <20190416170701.50333-1-wvw@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH] thermal: core: skip update disabled thermal zones after suspend From: Wei Wang Cc: wei.vince.wang@gmail.com, Wei Wang , Zhang Rui , Eduardo Valentin , Daniel Lezcano , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is unnecessary to update disabled thermal zones post suspend and sometimes leads error/warning in bad behaved thermal drivers. Signed-off-by: Wei Wang --- drivers/thermal/thermal_core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 6590bb5cb688..5baf5cfab999 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1494,6 +1494,7 @@ static int thermal_pm_notify(struct notifier_block *nb, unsigned long mode, void *_unused) { struct thermal_zone_device *tz; + enum thermal_device_mode tz_mode; switch (mode) { case PM_HIBERNATION_PREPARE: @@ -1506,6 +1507,13 @@ 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) { + tz_mode = THERMAL_DEVICE_ENABLED; + if (tz->ops->get_mode) + tz->ops->get_mode(tz, &tz_mode); + + if (tz_mode == THERMAL_DEVICE_DISABLED) + continue; + thermal_zone_device_init(tz); thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); -- 2.21.0.392.gf8f6787159e-goog