From patchwork Tue Apr 7 17:49:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Pietrasiewicz X-Patchwork-Id: 11478491 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D3CD15AB for ; Tue, 7 Apr 2020 17:49:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55FE62076E for ; Tue, 7 Apr 2020 17:49:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726705AbgDGRtr (ORCPT ); Tue, 7 Apr 2020 13:49:47 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:42962 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbgDGRtr (ORCPT ); Tue, 7 Apr 2020 13:49:47 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id 53C822972A7 From: Andrzej Pietrasiewicz To: linux-pm@vger.kernel.org Cc: Zhang Rui , "Rafael J . Wysocki" , Len Brown , Jiri Pirko , Ido Schimmel , "David S . Miller" , Peter Kaestle , Darren Hart , Andy Shevchenko , Support Opensource , Daniel Lezcano , Amit Kucheria , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Allison Randal , Enrico Weigelt , Gayatri Kammela , Thomas Gleixner , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, Andrzej Pietrasiewicz Subject: [RFC 4/8] thermal: core: Introduce THERMAL_DEVICE_INITIAL Date: Tue, 7 Apr 2020 19:49:22 +0200 Message-Id: <20200407174926.23971-5-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407174926.23971-1-andrzej.p@collabora.com> References: <20200407174926.23971-1-andrzej.p@collabora.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add a new mode: THERMAL_DEVICE_INITIAL. It is dedicated to handle devices which must be initially DISABLED, but which are polled at startup nonetheless. THERMAL_DEVICE_INITIAL shall be reported as "enabled" in sysfs to keep the userspace interface intact. Signed-off-by: Andrzej Pietrasiewicz --- drivers/thermal/thermal_sysfs.c | 4 ++-- include/linux/thermal.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index aa99edb4dff7..6bfef21abce4 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -59,8 +59,8 @@ mode_show(struct device *dev, struct device_attribute *attr, char *buf) if (result) return result; - return sprintf(buf, "%s\n", mode == THERMAL_DEVICE_ENABLED ? "enabled" - : "disabled"); + return sprintf(buf, "%s\n", mode == THERMAL_DEVICE_DISABLED ? "disabled" + : "enabled"); } static ssize_t diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 126913c6a53b..1bc6b7998093 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -48,8 +48,9 @@ struct thermal_cooling_device; struct thermal_instance; enum thermal_device_mode { - THERMAL_DEVICE_DISABLED = 0, + THERMAL_DEVICE_INITIAL = 0, THERMAL_DEVICE_ENABLED, + THERMAL_DEVICE_DISABLED, }; enum thermal_trip_type {