Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1478596ybz; Wed, 29 Apr 2020 23:30:30 -0700 (PDT) X-Google-Smtp-Source: APiQypJNIWtbiWfKjB2PWS+6EUl/vHhwu3f2JUp6W8oSv4w0OvvSV68MvOT2+dwCAeR1BIXNColF X-Received: by 2002:a05:6402:1d37:: with SMTP id dh23mr1240532edb.287.1588228230775; Wed, 29 Apr 2020 23:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588228230; cv=none; d=google.com; s=arc-20160816; b=OyGRlx17Ec63tH7eIVVpnhLmrVbjMBmGQb4H3+806FOt8NzIk5567ypvi4tr/+vWwQ Ny8R8nmIiJ7fjvmtsMcX9rdelY/tQo6oYPx0aFWdNy8Gj7UR6Ty/OO4psci4UtWxozlA rouiu0om+McujGUSL2fx0EwC8C+36cMaY2wzq2nQwQfl41OrVuhtO+MidVhTlZNJ17qB 0T/4+d84EihSko5Wrq3rg/BzGbG6unGDq8YBsmr6EotmbEaSE5lwlE2vxpfbePOPGvVb WJGRxExONzrmEOlBMmzdzaMHhvdo54QKtRysAgsQW6HIaq6OjN3JQYbUq+EbUZqYXDMj rbYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=gZIdn5+QJfBUHCHtcFObklMvdhMuw6oOYuC+fyaaVmY=; b=z2y99AopkMmSNq8rwJZxcvdaElbyIpSLcntQikPa/V+2M1G/7ER9e9wA7RJF1LQ++D 0uZrTozF+36SDdPZ1f7wy2JCVKjS/TKa451kfO6CftfX2N3iWmrqiASmFuEF7UPIhicy x0koEYLYw9J6IbY0PnOo6DFUpf5X1HUcg2ULNAsKudEOKgt3+stVCr2HRK11VbkRWLmJ 4PakK60F0jWoRMdqO0+2E8ypXoxaM7cWKH5FD5839Qfa7eA6fnQKrJy3BvCKcVsXo5dF fd73Vc9AD+TQPEVB8QvW7g20ZJKnQIk+SofyTQXV9ZQB/pjg9gcwp5SspaJlKBMFqTPJ zOmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m10si4726271edr.459.2020.04.29.23.30.07; Wed, 29 Apr 2020 23:30:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726571AbgD3G3U (ORCPT + 99 others); Thu, 30 Apr 2020 02:29:20 -0400 Received: from mga11.intel.com ([192.55.52.93]:25173 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbgD3G3U (ORCPT ); Thu, 30 Apr 2020 02:29:20 -0400 IronPort-SDR: xLOt+9/8epBFdLnHNdY1ndA6eD5rAQqKHaDitJDQvEP3F9LKUJCY+pQ0m9ybB8lfkVtwsS5rUd sjxS/34YL9WA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 23:29:20 -0700 IronPort-SDR: I7K1TkccSnlXnj2XU381CfWXGH4whQ968NBWcCrH9BOge+PJGtP5GtPpT3bX9JjjEKoemRqzeQ vYgk5qkmkqTw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,334,1583222400"; d="scan'208";a="282751674" Received: from power-sh.sh.intel.com ([10.239.48.5]) by fmsmga004.fm.intel.com with ESMTP; 29 Apr 2020 23:29:18 -0700 From: Zhang Rui To: linux-pm@vger.kernel.org Cc: linux-wireless@vger.kernel.org, daniel.lezcano@linaro.org, andrzej.p@collabora.com, b.zolnierkie@samsung.com, luca@coelho.fi, rui.zhang@intel.com Subject: [PATCH 5/6] thermal: core: introduce tz_disabled() helper function Date: Thu, 30 Apr 2020 14:32:28 +0800 Message-Id: <20200430063229.6182-6-rui.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430063229.6182-1-rui.zhang@intel.com> References: <20200430063229.6182-1-rui.zhang@intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Rename should_stop_polling() to tz_disabled(), and make it global. Because there are platform thermal drivers which also need this. Signed-off-by: Zhang Rui --- drivers/thermal/thermal_core.c | 17 ++++++++--------- include/linux/thermal.h | 2 ++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 5f7a867..1cd5d5d0 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -305,16 +305,9 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, cancel_delayed_work(&tz->poll_queue); } -static inline bool should_stop_polling(struct thermal_zone_device *tz) -{ - return thermal_zone_device_get_mode(tz) == THERMAL_DEVICE_DISABLED; -} - static void monitor_thermal_zone(struct thermal_zone_device *tz) { - bool stop; - - stop = should_stop_polling(tz); + bool stop = tz_disabled(tz); mutex_lock(&tz->lock); @@ -502,12 +495,18 @@ int thermal_zone_device_set_mode(struct thermal_zone_device *tz, } EXPORT_SYMBOL_GPL(thermal_zone_device_set_mode); +bool tz_disabled(struct thermal_zone_device *tz) +{ + return thermal_zone_device_get_mode(tz) == THERMAL_DEVICE_DISABLED; +} +EXPORT_SYMBOL(tz_disabled); + void thermal_zone_device_update(struct thermal_zone_device *tz, enum thermal_notify_event event) { int count; - if (should_stop_polling(tz)) + if (tz_disabled(tz)) goto update_polling; if (atomic_read(&in_suspend)) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index a87fbaf..0bc62ee 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -479,4 +479,6 @@ static inline int thermal_zone_device_disable(struct thermal_zone_device *tz) return thermal_zone_device_set_mode(tz, THERMAL_DEVICE_DISABLED); } +bool tz_disabled(struct thermal_zone_device *tz); + #endif /* __THERMAL_H__ */ -- 2.7.4