From patchwork Wed Dec 9 15:34:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 340361 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp4700357jai; Wed, 9 Dec 2020 07:35:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFZ6Kh8y/1zv5gkAI4fmCF612u75eXt5J7Xpxv/9tEE69st0lJ+Pxsq0cEPtiDm/RkiwWX X-Received: by 2002:aa7:d0c5:: with SMTP id u5mr2481774edo.46.1607528138738; Wed, 09 Dec 2020 07:35:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607528138; cv=none; d=google.com; s=arc-20160816; b=myArtRsuR2/7M2spexG+Dj9briyGVFyenp4813fxuSLoxjYrUT1R5t1P4H9B7/Sfq/ nAkFNGU378SkVDtYNxWQXQ2MVIv2aRKdJxAVJ3JcOqbowIS+Tt8ev/9V2fWj6hx42P8N V5i8UcqestVhsriKkRwxF6tQqjuxYAZKm/zyslh9/J4c+/dkeoT9fHNgnGiaiXmnd9XP bjuEHQe0gObFIrItvxogpxKNvQwQZb2TCZ6+BEDc0gV/x6DS6mKakZMS+5rvAyeRit/Z KT6TtrLeS7Sbg/077P3t5jIfIKS7fWSYbMcLauzCIGa9VnmSJJOjkSxnSpt3+W15sML8 JHTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=9lzHda3DkRGsaAMWdU4VLGvm72yuNdC03lUHj7g0BKQ=; b=e7J5PWahfwmhABj8gpK3R9KAZYcnR7+J3k3T3w6BYqmZNVN4epZWzQC5HWQHhZp+46 6ZuM0iiXQshsW0M5/JNwrS6ybSJXzPlQLIfDAzkn92SWjOUZt2L2pvOzGEbKlRLD8zWL erWtvgvEnozSEfwJfk2aSx7m3pRFKYsRYPvC8IGlhBoDh1wGwQ8vV7UyBMJhwLh2ZNI6 9VMbL0vyW0OSe5mpUtmWJPrNegjHX7ZpywJAx/JisZPCA7tlsTkFUdlTMb0jJ0oMkiFh 0MD3PUv3vSNl/LUYXBGkjyB9cFtYvVncALu+USlxRGWilYfA5ogHxNl2iighbz/dfSyN VlBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GhhAbALh; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zh18si911866ejb.624.2020.12.09.07.35.38; Wed, 09 Dec 2020 07:35:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GhhAbALh; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730271AbgLIPfh (ORCPT + 8 others); Wed, 9 Dec 2020 10:35:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730251AbgLIPfh (ORCPT ); Wed, 9 Dec 2020 10:35:37 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 534C0C0613CF for ; Wed, 9 Dec 2020 07:34:57 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id c1so2197352wrq.6 for ; Wed, 09 Dec 2020 07:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=9lzHda3DkRGsaAMWdU4VLGvm72yuNdC03lUHj7g0BKQ=; b=GhhAbALhf3of5VkM2LzUNsHuJej/dySMGdw+z4MhNerh+DyFl2VMiQPQUKh+LaYUmI VpJhaNHjrf/rXuhqRsIUFXqGRMyBc6xDLtKhYCXxFumdI6xus4ampbKpcW20dT21uhzo NzBSm6B/tkCCC+Jw2zUB1nHjRbrennKfbarqT5q41Echd4XojfMpSnYvtDXTDIc8lL9X Jw4nuFMB49N82BkXjTUHAhxnZABYDRwvuiDR4greQsliJsT3hp/tR1x8VgoJOqECP4jD HLR1s/5OJyl0P6PJ16FWcE7y5ASg2d+foQGcIDjmcH2rXRL3Pn4thGD3T4wgEXWp5RUs wkWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9lzHda3DkRGsaAMWdU4VLGvm72yuNdC03lUHj7g0BKQ=; b=Jet81tER1zP/esnpCpWEbek3nry2EerECyefFpyM2kbAasgT7O4aZjnnu1ADrD+r9i WQo4Wk61XR6Vu3c534HuFm37bbzyouGrbm6wacfZ210seiQVkRt0nuKm85+tnBKRn9NL vyRlESjTStHxhEK7on1GeZymC6SNqJgg2hnkU42e2J2ZHV7maf6ZKR0HPomXZajO2tc8 ubOypRzkXbdrRJIUxUYyAiZBgqpovMXLS6uv7F6DLVCFktGHBJcw9t7v6jzTOW6DyKLz LGShWlby55mV53S8H8YVMaVrggwYEJQWxoqvaJRvSzeNg1fukOlXX43UJNEHg2jKxlmf E4IQ== X-Gm-Message-State: AOAM533LDs1TPksJ4u1TEovYM+5/c8IccUHkQ8UoSQQokvUPJPZ+2yp7 cCs3NH1gPhAve9dQ3W4lKdxYVA== X-Received: by 2002:a5d:5604:: with SMTP id l4mr3317757wrv.127.1607528095968; Wed, 09 Dec 2020 07:34:55 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-158-132.adsl.proxad.net. [82.252.158.132]) by smtp.gmail.com with ESMTPSA id l8sm4208382wmf.35.2020.12.09.07.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 07:34:55 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, lukasz.luba@arm.com, srinivas.pandruvada@linux.intel.com, kai.heng.feng@canonical.com Subject: [PATCH RFC 1/4] thermal/core: Emit a warning if the thermal zone is updated without ops Date: Wed, 9 Dec 2020 16:34:37 +0100 Message-Id: <20201209153440.27643-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The actual code is silently ignoring a thermal zone update when a driver is requesting it without a get_temp ops set. That looks not correct, as the caller should not have called this function if the thermal zone is unable to read the temperature. That makes the code less robust as the check won't detect the driver is inconsistently using the thermal API and that does not help to improve the framework as these circumvolutions hide the problem at the source. In order to detect the situation when it happens, let's add a warning when the update is requested without the get_temp() ops set. Any warning emitted will have to be fixed at the source of the problem: the caller must not call thermal_zone_device_update if there is not get_temp callback set. Cc: Thara Gopinath Cc: Amit Kucheria Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Lukasz Luba diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index dee40ff41177..afc02e7d1045 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -548,7 +548,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, if (atomic_read(&in_suspend)) return; - if (!tz->ops->get_temp) + if (WARN_ONCE(!tz->ops->get_temp, "'%s' must not be called without " + "'get_temp' ops set\n", __FUNCTION__)) return; update_temperature(tz); From patchwork Wed Dec 9 15:34:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 340362 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp4701595jai; Wed, 9 Dec 2020 07:37:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXIqY4RpaeWBYh4lAqeXyfehQyFIt5tsWqC6wR5TQfpvQ+bgrzOZIwnYsqFWOg+g2NFsL6 X-Received: by 2002:a50:d553:: with SMTP id f19mr2457732edj.323.1607528231867; Wed, 09 Dec 2020 07:37:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607528231; cv=none; d=google.com; s=arc-20160816; b=jxmrHc5m0lRTuzEHLROTD8X17i4/avF6ulcabWfSsRHzNQUPUwHJXMPRvDnGcxzp24 ZJuXctCLtbYMx4AsuAX/d2SEcSI+cKhpGrzAZpDHOl/SrnFXwe23TOqkznBJJOrIfwfl /VAyqAXiZ/NnQj41MfK2tkDrtBspvt7B6NjhEUz05ePVg/Qs8Z3DPCcGwbx8kS5xV/Lj CDSn+RJ/IqYj99suL4LNg9+TwCK2R0LIb04gpWLhpvQe7SA7XXbu/84eEzDOHNGewfax WG1jA7f8dFq2sw8DMPfO7EMrcu9ze14Ive2OrYA04hyeSWFba9os+fCTS0H7wmsmAnVc XCNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=uZgB0leTvg1UsktdCSGjVr/1XPMUvecMHEZ3uvN+Jrs=; b=vFfz6+SazxqPnrA+oxRZIrx+WHnJU0XZQ7EgwxKLEYaUGtj01tPP3xY5pS2bzD/AQa KHzEP2SDZ/By5V8dFdSdMKskTpEkBqZyLGiUU6VKsLuS7qAG2onH+4IRNDEJvuuT98xO mowPcOKmYX15qgHA2sTNXcCNR6kuf07Dr0cvbLnvNOMjE9NfcgInNW4jxeCunrEhgO2/ QRUoYloJxRXolMzb43cedji/oR1vxx7dnmL/j87X5qwL0fHDOsQhxIgN23hH5lf1G0jw Z/NXIOfKJ1KQoWsRoVAGV6U2BG0Jed65CfEGUEihAnY6hFg54UMdw+xF23O1Gp6mrKHD 66bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F1tBk6wp; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si966683eju.216.2020.12.09.07.37.11; Wed, 09 Dec 2020 07:37:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F1tBk6wp; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730344AbgLIPft (ORCPT + 8 others); Wed, 9 Dec 2020 10:35:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730267AbgLIPfj (ORCPT ); Wed, 9 Dec 2020 10:35:39 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E1AC061793 for ; Wed, 9 Dec 2020 07:34:59 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id r14so2220411wrn.0 for ; Wed, 09 Dec 2020 07:34:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uZgB0leTvg1UsktdCSGjVr/1XPMUvecMHEZ3uvN+Jrs=; b=F1tBk6wprLcmk00DtZQ6R59rv3L46LFPHO/2ciwFjtLCuYm5PJP0BjZN4ZOJbYJgfk H+jHuOwBy7yYnV/eHCtyHzb5MNgnKRgRypI7xtZw7QyBVbpKHa3/v/cEneGshwiT4ORO jiwS1ZCM+oriLm2b/XBhvEd5T9UeaPSUYY3Sl8UpbziFCxn7v4vWvfG8he27OrfNlrX+ cm3Ow40123cgL/PEMHbD1hTWhHs1BdQHdjX9eVmJ/Aa7MKFTvQHMpP9V4konws4JGJ56 oZASkqVYSa1HrFWDsawVvObROGi7fH+VBAVuuDAgruicHOBx3gfcuVrP4KMSLxXH9v7N MCdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uZgB0leTvg1UsktdCSGjVr/1XPMUvecMHEZ3uvN+Jrs=; b=eybQIm8oF0dp30sgmgS981+R6LB5aacl+tfG9wEBUr5NPwisZA0QgOJWnRPupnM7kT hfpc0HhhNwgJJrmW4wfyIieBg8VPkJXIoCOeCmmbLAmRoOmg3SSvYTtcUebLJHFqUWo/ yK2B4VgjE7XUxaDwBgQj4cEvF6aWXAW76DzQHcJaVWSq9Ov3KwYwH8gCxu+ex29svc9q zuxF6IaLB4UUp9FVK1JZn8xi+cqIElfV2wI4bu98W/H2/vKbUlL/4bF44kkYgIfhb37p khQOSwuEKzKrThqEIqjsolHmfFVd7+iTDvOh8cA6z3Ppk0miAcn2Yn049xrcP8xa9DBJ Dlww== X-Gm-Message-State: AOAM533QUPyadZ0ipY1BytaU2j1rAwn3VV9wNSzo1rCJi5YsI/ZzWncz CYlIGHWsJaP2Ly2zvntriPJ6ww== X-Received: by 2002:adf:dd04:: with SMTP id a4mr3364031wrm.77.1607528097603; Wed, 09 Dec 2020 07:34:57 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-158-132.adsl.proxad.net. [82.252.158.132]) by smtp.gmail.com with ESMTPSA id l8sm4208382wmf.35.2020.12.09.07.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 07:34:56 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, lukasz.luba@arm.com, srinivas.pandruvada@linux.intel.com, kai.heng.feng@canonical.com Subject: [PATCH RFC 2/4] thermal/core: Add critical and hot ops Date: Wed, 9 Dec 2020 16:34:38 +0100 Message-Id: <20201209153440.27643-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209153440.27643-1-daniel.lezcano@linaro.org> References: <20201209153440.27643-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Currently there is no way to the sensors to directly call an ops in interrupt mode without calling thermal_zone_device_update assuming all the trip points are defined. A sensor may want to do something special if a trip point is hot or critical. This patch adds the critical and hot ops to the thermal zone device, so a sensor can directly invoke them or let the thermal framework to call the sensor specific ones. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 42 +++++++++++++++++++++------------- include/linux/thermal.h | 3 +++ 2 files changed, 29 insertions(+), 16 deletions(-) -- 2.17.1 Tested-by: Kai-Heng Feng diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index afc02e7d1045..0366f3f076cc 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -375,6 +375,24 @@ static void thermal_emergency_poweroff(void) msecs_to_jiffies(poweroff_delay_ms)); } +void thermal_zone_device_critical(struct thermal_zone_device *tz) +{ + dev_emerg(&tz->device, "%s: critical temperature reached, " + "shutting down\n", tz->type); + + mutex_lock(&poweroff_lock); + if (!power_off_triggered) { + /* + * Queue a backup emergency shutdown in the event of + * orderly_poweroff failure + */ + thermal_emergency_poweroff(); + orderly_poweroff(true); + power_off_triggered = true; + } + mutex_unlock(&poweroff_lock); +} + static void handle_critical_trips(struct thermal_zone_device *tz, int trip, enum thermal_trip_type trip_type) { @@ -391,22 +409,10 @@ static void handle_critical_trips(struct thermal_zone_device *tz, if (tz->ops->notify) tz->ops->notify(tz, trip, trip_type); - if (trip_type == THERMAL_TRIP_CRITICAL) { - dev_emerg(&tz->device, - "critical temperature reached (%d C), shutting down\n", - tz->temperature / 1000); - mutex_lock(&poweroff_lock); - if (!power_off_triggered) { - /* - * Queue a backup emergency shutdown in the event of - * orderly_poweroff failure - */ - thermal_emergency_poweroff(); - orderly_poweroff(true); - power_off_triggered = true; - } - mutex_unlock(&poweroff_lock); - } + if (trip_type == THERMAL_TRIP_HOT && tz->ops->hot) + tz->ops->hot(tz); + else if (trip_type == THERMAL_TRIP_CRITICAL) + tz->ops->critical(tz); } static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) @@ -1331,6 +1337,10 @@ thermal_zone_device_register(const char *type, int trips, int mask, tz->id = id; strlcpy(tz->type, type, sizeof(tz->type)); + + if (!ops->critical) + ops->critical = thermal_zone_device_critical; + tz->ops = ops; tz->tzp = tzp; tz->device.class = &thermal_class; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f23a388ded15..125c8a4d52e6 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -79,6 +79,8 @@ struct thermal_zone_device_ops { enum thermal_trend *); int (*notify) (struct thermal_zone_device *, int, enum thermal_trip_type); + void (*hot)(struct thermal_zone_device *); + void (*critical)(struct thermal_zone_device *); }; struct thermal_cooling_device_ops { @@ -399,6 +401,7 @@ void thermal_cdev_update(struct thermal_cooling_device *); void thermal_notify_framework(struct thermal_zone_device *, int); int thermal_zone_device_enable(struct thermal_zone_device *tz); int thermal_zone_device_disable(struct thermal_zone_device *tz); +void thermal_zone_device_critical(struct thermal_zone_device *tz); #else static inline struct thermal_zone_device *thermal_zone_device_register( const char *type, int trips, int mask, void *devdata, From patchwork Wed Dec 9 15:34:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 340364 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp4701636jai; Wed, 9 Dec 2020 07:37:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwN99gu3DCVUcdQDk2n6yVcB4RsCnuxUsiMj1g6zbYkMaS4ONBaeocPj8OIVEUxUnmhlOZQ X-Received: by 2002:a17:906:578e:: with SMTP id k14mr2613799ejq.90.1607528234163; Wed, 09 Dec 2020 07:37:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607528234; cv=none; d=google.com; s=arc-20160816; b=mZk0p2PSee0r2hs1RHnyEodnO1ukDhKFvIq3STHDlE83M8k4jNU5z3NjpmIvLUqObO +Q+8nPE4LHAauB18ygpm8YHoRlm0iM5LDtER19r7Cg1c8Ri6+kFdF4JtWz6if1EOKV5Y 4qNAW/G/WsQMOorT7jDLn2ZlGACcC0qWPBRJfzmTKW6BzpmdtTNFeyIR7Zk6FtYtXhuH eKsvEOQdYOKHpx5oyCRQ01CjmNrkgNrHCh04aZPNNTPlvUmC6n29NL62RE58Un15dvZm W9ePKBSsSn/DtvCIN1Qq2LsLW4ZHGhmnlT6zWL7FtMp3mq5WSPmp1IvUuptrlvzdNgAI AWfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=yGhkI0Nvl2v1YOr6xjZSuObttiQ410GAIRH2LwhmlJc=; b=0aNBJ840jjNZcWBs31+kV2Kq8WRmM86ul1YOAXkSFxrDi2pazHxlW+WpY9Xk6hjToL R9piTkhYz9qo4FBVxBkqnobbQrF3aJBYINnmxSV76GrigyO0RX7X8a1XU3a3U2DmYR8h MVOiS8Ve+5lZOeF9iJHwzA/nRuG4QWOHqp3r7hSMZeQtRpgQuO0UsDgCMUDVQPmQ8C5J RmsPoo7FbZU7hagsj4SezkhVrLboharoSXlr4KzbcfxP1ipsM5lJM3asXMLeVMqa8mxV XBmAks71USXzvXcnxgJ99048jFK3DJ/3SWvGSDs+AYSvyP/ilBkSKur+fbMu+7deSX3j +XEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HIV7WPtc; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si966683eju.216.2020.12.09.07.37.13; Wed, 09 Dec 2020 07:37:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HIV7WPtc; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbgLIPgZ (ORCPT + 8 others); Wed, 9 Dec 2020 10:36:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726110AbgLIPgR (ORCPT ); Wed, 9 Dec 2020 10:36:17 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72632C0617A6 for ; Wed, 9 Dec 2020 07:35:00 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id c1so2197543wrq.6 for ; Wed, 09 Dec 2020 07:35:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yGhkI0Nvl2v1YOr6xjZSuObttiQ410GAIRH2LwhmlJc=; b=HIV7WPtc6ODm6QVuYGg+4MlniUYOUmab4M0+KgvZTziefWPzKbXetKC6+2XxCh/QvQ yFFp9VMJskrFNXe9up7lz2BfTZBEFYIERLOPdASA4UmOnKc0A5GNTUeIyvINYia65JwX Arwx3Yw7nHDTwELwR6HndyRfHZgHrxTBDWrTgXXlxshFmzCgU6qRdiePdIMJgpVvXRY/ PXRs7AIaJc1z4PV+2GQmLrr/++ZMZnoYqG3mO+lsvOSM+0N1x7kiuMpoa5HB9o4XzdrB clLbxNpZ6XGOAkwdJwnrqpPcWvVXb6q/tGhBSwLoNhjVt7OrMy95bCc9xMryxswNsUQr /ACw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yGhkI0Nvl2v1YOr6xjZSuObttiQ410GAIRH2LwhmlJc=; b=VUrh6NZuyS1OdQgIzj3CIGrTHF9p/JmsOAPUTzRDPkOIb+QTKoFCjP0znCsP6oKT1v 2Xnm3HLsfjAshBhDjrkHQrQSBytUXlF2B30qelsCXbMSaV1kfslCEpFLqcHjx5C+KN/9 UiOwVI+6iYOcevHP7gWZJMCIlxqDHg4Mwj46iVuR3E47jAuyCxTLwAqVFlykK5BQts5a NW49Sv1Pt+xMynMmJtk10oUw5EqB/V7RGmik2zy2Cc6aR1dNaU9zkDPvI/ZioAks2fDW R/kCMxS5LXLTKSXMFvkf5kj4wY8+doQUKpopix+ETySutmBwNzibPWkX5CmloxMkW8uM mKgA== X-Gm-Message-State: AOAM5322+byMUcj3uDGvQ2Vhl1p3uT6OqUbM/0rMd1UDU0LsMljoz0iZ sf22se4URGf1CC0GWicqC4Ifrg== X-Received: by 2002:a5d:684b:: with SMTP id o11mr3351145wrw.157.1607528099091; Wed, 09 Dec 2020 07:34:59 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-158-132.adsl.proxad.net. [82.252.158.132]) by smtp.gmail.com with ESMTPSA id l8sm4208382wmf.35.2020.12.09.07.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 07:34:58 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, lukasz.luba@arm.com, srinivas.pandruvada@linux.intel.com, kai.heng.feng@canonical.com Subject: [PATCH RFC 3/4] thermal/drivers/acpi: Use hot and critical ops Date: Wed, 9 Dec 2020 16:34:39 +0100 Message-Id: <20201209153440.27643-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209153440.27643-1-daniel.lezcano@linaro.org> References: <20201209153440.27643-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The acpi driver wants to do a netlink notification in case of a hot or critical trip point. Implement the corresponding ops to be used for the thermal zone and use them instead of the notify ops. Signed-off-by: Daniel Lezcano --- drivers/acpi/thermal.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 12c0ece746f0..b5e4bc9e3282 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -677,27 +677,24 @@ static int thermal_get_trend(struct thermal_zone_device *thermal, return 0; } - -static int thermal_notify(struct thermal_zone_device *thermal, int trip, - enum thermal_trip_type trip_type) +static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal) { - u8 type = 0; struct acpi_thermal *tz = thermal->devdata; - if (trip_type == THERMAL_TRIP_CRITICAL) - type = ACPI_THERMAL_NOTIFY_CRITICAL; - else if (trip_type == THERMAL_TRIP_HOT) - type = ACPI_THERMAL_NOTIFY_HOT; - else - return 0; - acpi_bus_generate_netlink_event(tz->device->pnp.device_class, - dev_name(&tz->device->dev), type, 1); + dev_name(&tz->device->dev), + ACPI_THERMAL_NOTIFY_HOT, 1); +} - if (trip_type == THERMAL_TRIP_CRITICAL && nocrt) - return 1; +static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal) +{ + struct acpi_thermal *tz = thermal->devdata; - return 0; + acpi_bus_generate_netlink_event(tz->device->pnp.device_class, + dev_name(&tz->device->dev), + ACPI_THERMAL_NOTIFY_CRITICAL, 1); + + thermal_zone_device_critical(thermal); } static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, @@ -812,7 +809,8 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { .get_trip_temp = thermal_get_trip_temp, .get_crit_temp = thermal_get_crit_temp, .get_trend = thermal_get_trend, - .notify = thermal_notify, + .hot = acpi_thermal_zone_device_hot, + .critical = acpi_thermal_zone_device_critical, }; static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) From patchwork Wed Dec 9 15:34:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 340363 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp4701623jai; Wed, 9 Dec 2020 07:37:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTBAUqCbRm/lMYzM7Hy13brvkQFutfkuA6PHV65lABXKqX4ZjsMvI+7GmdB/3Sl7zfr+gR X-Received: by 2002:aa7:c4c2:: with SMTP id p2mr2555456edr.63.1607528233691; Wed, 09 Dec 2020 07:37:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607528233; cv=none; d=google.com; s=arc-20160816; b=e+xVgU7hAJrZW9Zy1FtBiv8HbspJ2GEk2C0m38qwhbek5OiKdAP2d/oc8O7/nk3mnE kzdl/1Pj5br7x9vSITfeqTU+RZ4uWp3hqZ0V4U7VjaAawFGKWcVMfhanphf2POCwYVzb 2DQPQm4yGPe7Zc7oaqM4FcFnV1DoQjO1vaXO+BB7E4D1Qyp2IV6nZCG0ub0+4xXOJT4G WrwdHRBi8XDtdIFge938aEc/ouxnYtRm62Pob4BoeNO65/0F3ndMH7ovM/PnDyqbUrf1 vjE5WdQuv8mE2utdIs14SFNSPVQxggHyMIxUqwWJHRpK10Kozy9GrRHYxRd7Nc1Oh791 nzqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=NyznDPS+potp54SZ8vXhKxNkqaQy2TwObORIS4uz01k=; b=MFHpw9u3B96IZYPLvAxwsqEBe5N0z7+VAG++01YvKn91Ru1rv6tbxlag+BdrjHm/eB InH3w1vzsKrXdpLZ8EoHo7lGRItb2cxmfRBwRO/TLhCNbgPHc/7SZklzIlceLm6ol5l4 lsgmW4fDnuz7CyIFoPWnQK0hBhVx7UdEyL7sDyMGJOU50Esa6VOg7nefhBIUXdFl+CLg GejN8pCTaGICknCztMShBKSMEbeWgOqscJ7c+CxCx8mYTDfQ9gUD8rQIZaTfmIMqVfwY eN1Q23t9rUnUXJIXOlAo4+D8k8J4LFZ2rh/uQf+jd5B+6sluoNe7wRQ9ZNEV5f0CPgxO XQcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kf+OH8cE; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si966683eju.216.2020.12.09.07.37.13; Wed, 09 Dec 2020 07:37:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kf+OH8cE; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729377AbgLIPgW (ORCPT + 8 others); Wed, 9 Dec 2020 10:36:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726526AbgLIPgS (ORCPT ); Wed, 9 Dec 2020 10:36:18 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 266DEC0617B0 for ; Wed, 9 Dec 2020 07:35:02 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id k14so2228717wrn.1 for ; Wed, 09 Dec 2020 07:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NyznDPS+potp54SZ8vXhKxNkqaQy2TwObORIS4uz01k=; b=Kf+OH8cEA1M0oMUKxOimRjomrUM1OT3bBuEgBhvosuc/kv6TiUjOoaZOr0Gd+uWX8h YkpSaxUv8tKgAM/4YZy52+gv6PgiEroIFcWq/gvVIW8ogML7LEDM4nEkYlah33VEVNpZ 4jnhvrfzxl9gG0cy4uy4mb1rMEIeNhRMaJ5uxbktDyUfDlWdh0dboCGHdf7RdNPL8dpG 3Tm1fSlZJ2se6iyovuQDgLXqJKAmV7A3lhrVeokhA+bK6BP4yc1XboHAYwchOpzBcx3D oscTKaAKObz86YxBe6NFsNY6UgN2KcUUwFffQorz+EKHPqIJ0f2aif0wfTgm0ONaWZ1a MEbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NyznDPS+potp54SZ8vXhKxNkqaQy2TwObORIS4uz01k=; b=Tp/rOA95+wMCp509iC8QsAs0Y1DCplgx80DuuKRBbWIac0OoEP7v0aruqQGdzSg9qz Yw7ukdvbj640D1hFCo5sPS7cdslpemrnRi9x/gRP1pl9LnGo6qP6CIx3hJ+YubHXVVLq CD//mPCRmZuXHwgHSIj/vBFa3xU6ZvXW8t69/gr5exPrFlCrfNax9+Ep1YvnLDUu/iu7 Up54rqNruDp3420uDNrAscosP5wA6xamFTsGaD/k/RkLgnma1gAUwryVye1uCg5jTm/X zcjqysoHtjq2kabhi0b/pEVOqK+0SZJ3Z0EZ/chn1e1SC+J2zlYyAVbq1pJ8JQGDzl8j uetg== X-Gm-Message-State: AOAM530VLg8K4IWFkwbPRrn64xlIsCnL2m9Qpu3fwVk+e6FZnZ6OivEN xgj05nauXKtRiIs3Zi3iYZ3MVq0VyzwY3A== X-Received: by 2002:adf:a4cc:: with SMTP id h12mr1039614wrb.391.1607528100738; Wed, 09 Dec 2020 07:35:00 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-158-132.adsl.proxad.net. [82.252.158.132]) by smtp.gmail.com with ESMTPSA id l8sm4208382wmf.35.2020.12.09.07.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 07:34:59 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, lukasz.luba@arm.com, srinivas.pandruvada@linux.intel.com, kai.heng.feng@canonical.com Subject: [PATCH RFC 4/4] thermal/core: Remove notify ops Date: Wed, 9 Dec 2020 16:34:40 +0100 Message-Id: <20201209153440.27643-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209153440.27643-1-daniel.lezcano@linaro.org> References: <20201209153440.27643-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org With the remove of the notify user in a previous patch, the ops is no longer needed, remove it. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 3 --- include/linux/thermal.h | 2 -- 2 files changed, 5 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 0366f3f076cc..8a47369f0432 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -406,9 +406,6 @@ static void handle_critical_trips(struct thermal_zone_device *tz, trace_thermal_zone_trip(tz, trip, trip_type); - if (tz->ops->notify) - tz->ops->notify(tz, trip, trip_type); - if (trip_type == THERMAL_TRIP_HOT && tz->ops->hot) tz->ops->hot(tz); else if (trip_type == THERMAL_TRIP_CRITICAL) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 125c8a4d52e6..7e051b4cf715 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -77,8 +77,6 @@ struct thermal_zone_device_ops { int (*set_emul_temp) (struct thermal_zone_device *, int); int (*get_trend) (struct thermal_zone_device *, int, enum thermal_trend *); - int (*notify) (struct thermal_zone_device *, int, - enum thermal_trip_type); void (*hot)(struct thermal_zone_device *); void (*critical)(struct thermal_zone_device *); };