From patchwork Thu Dec 10 12:15:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 341030 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp5580242ejs; Thu, 10 Dec 2020 04:19:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMSuZy/n+Gqj1LF6wmq9Tm7K7muoFFzmZRIMZ4FlvY/OaEcAi3qktZCoqhduf2xkg1IfVL X-Received: by 2002:a17:906:6010:: with SMTP id o16mr6203121ejj.55.1607602789327; Thu, 10 Dec 2020 04:19:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607602789; cv=none; d=google.com; s=arc-20160816; b=aau5Rj3SVeVsm3Pp/87oBk2ll4jJbl1+Xt+QX3CKv3qV+Mkv//BUKtLEwDH1HSCbh/ 0kMEwLwvGeI3nZ8z+Ssp2Cd33uCxXqe+l6HK5N/g16kudSt9BUfjWqtYdamvD060Jv4E jeXwYqG4lxQfJ4iqYTLGCCD16WDwUqoMaITi//ujf8IXX/1VIk4eCXnhEaEA3IHb2f1R LNStKCHi2ycGVxEAKb8y4xzu+9LbpF3w7GZrTjS4h1vw6gfYtWIv6OoOMsdIlljoYGf9 UWlOseco/Mm4Fnyjg4/VaW9BZpU3nakWjawoObpeHqNrgo2L6Ei98clY9uQ9lREC7SQ5 toKg== 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=zL87uP9zZKcHDPlqA3C3LRM3A468R2HDW77HRWlimGBRT6iqfmjI+VAISJAoKLLzxy YdLNLxxbXA19kYwS77zyiE2f0NbT4oTEHFo0//pyYAMt/ScVqZwMkQCiXjPau0vGKLRj nBq7GtKSW9XUtzHeg8CqGY0KqyL9csrFPMbJraTYi1QyQ3YutS3ISVVyXzKXX+n9gn7l EPXgdRKxd6PNvpOjm36Dh+GcINreHPklZa+od4P8kNdm258HHM3FWyCrUnnUwWafntUo JXk5HhZtjW7dKiIA1QjIRintiY3EMzcH/woKshKoWnYg4s2I/SBzYaWQeMujg/hPXl1C aF7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZMSbcIK2; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-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 v10si2497890ejh.387.2020.12.10.04.19.49; Thu, 10 Dec 2020 04:19:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-acpi-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=ZMSbcIK2; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-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 S1727126AbgLJMSl (ORCPT + 5 others); Thu, 10 Dec 2020 07:18:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730598AbgLJMQU (ORCPT ); Thu, 10 Dec 2020 07:16:20 -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 351A3C06138C for ; Thu, 10 Dec 2020 04:15:27 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id r3so5256515wrt.2 for ; Thu, 10 Dec 2020 04:15:27 -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=ZMSbcIK2yxYS9l9B2GzHVfejc6B3rHRV5UJ8q7VdYPEqRXff2fFPPNksU5fw71fG+N 8SxBatY1FqP9r6q5mokjvTVNEIwohT1PByGJvTI+G4zF0+2HSXRdY0OvzSqzTqx9SzpJ qa7VGWE6IrLf01CFNxpX3TxHAUPjm/+l4ZJFpe5N7g147LMQw1O5VvhB8aEBl5mMZVx+ /utICSCyTaGdxzTCb2V9uuc1QtwKd79tR0FZgqtXwccqAmpb7Qx/hwlXD0/0DUEoqagH 5w9fGIncchXp+PQgeoXk5QaDKIbk8P7fojCg8mIS2Djb3DyBCvXQ0MPETTUi2jBZvrcs JMvw== 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=dSHHnRzO0TfT2zBNv++Yq9mJuGd+B7hrG8EZmDbATF90sw02yDXsqzxpgRIYLjLpek CmJljMUW3jQ0QeBAgWQ2IUJ/rlkqEPUAJEWRLES8S4PhnSBLQAnkoKgng5jXvvafeZHh CJktlGg5BkFaoxEZWL9KTcItBFuc+mKXS1+rDKxXMAl+ZX/n4W1MELB2JvtVNV54nhKX VfoHuZuaSU3B0s/x42hoUC0TjM1X0f8J/TD5mtd5Mdltia0z6Rdh9HEFjmBV9SUJZRDS vWBsfhpHrclw49ULuOPrDYjJRIcSY+/CDpLPiE/0hSJqf23AXYU0xeX9WdF9Mh6ir0qu AQVA== X-Gm-Message-State: AOAM530E1233xsXk6VGle9Kx+BtcUYAb8t92MKT2HCFGlMTQnBDbCxS6 KSp2/TGFlYvMT8ru8FiJS9WKsg== X-Received: by 2002:a5d:5105:: with SMTP id s5mr7684847wrt.136.1607602525876; Thu, 10 Dec 2020 04:15:25 -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 k6sm8412863wmf.25.2020.12.10.04.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 04:15:25 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: kai.heng.feng@canonical.com, lukasz.luba@arm.com, srinivas.pandruvada@linux.intel.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org (open list:ACPI THERMAL DRIVER) Subject: [PATCH 3/5] thermal/drivers/acpi: Use hot and critical ops Date: Thu, 10 Dec 2020 13:15:12 +0100 Message-Id: <20201210121514.25760-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201210121514.25760-1-daniel.lezcano@linaro.org> References: <20201210121514.25760-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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)