Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3383005rwb; Mon, 7 Aug 2023 12:35:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgMuC8pPsMTn805cJxkP3sbwZIjAOxbms+s6qXkdJ0Zb6+sxAsdmZjc+wXbLeP47v3NEuV X-Received: by 2002:a05:6a20:3ca5:b0:137:23f1:4281 with SMTP id b37-20020a056a203ca500b0013723f14281mr12149805pzj.12.1691436958871; Mon, 07 Aug 2023 12:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691436958; cv=none; d=google.com; s=arc-20160816; b=bYWNzB9kZzU6jSZMeH0vRd2FiSX/BHdFnWyMKju1rytUQdkxHI//usNgFQ67r/9t4e 8hvoiXMUxEiWIAwbQzn2PV5lIKuQBqAY35JnAoP6foPoKYtdDzg+Lb88y9CAUuagRDhU h1I9u/J4+NSNrZ4xYLbqynuqoMZAOvCYoDpOnDQ8Rj1THIH0jue5Rk1/LtkDCDPcqnA0 7gVfwabuQfrQvtNnNoca8zGm37Lr/jtVVJ8wVSDh/DzWwsMQmWgbikw42x1BCtiidsVf G/3ceneTJDzZUU/8+950NFUeFWZddCiZQWLVqUcMXI156UtibJJDTka9aaApaa/mw1jM Dp2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WaV3MhxYhZbPX0TiuC6laGzxiuSszT3Z+Z0AHWyaVb0=; fh=jABj5v2rHKw019HO9Ag6891M+lPZ6d+O4eAkd8el8mQ=; b=INfhEB1oroHK5i2GGbgS7sf2p1DiVxfF22qcuHQV205W3ZhMRPL+iRKJa6ka+qVaLD 7N4/kgEEyOG36epk7/SVQuGHE9PUHFhu3LdC6RFWvobSBNZQLBdm/v8iUCB2uhdWrj8B ZHuQh2la0LB8+n4Z/wlZvDZ13tpofnPE2a7V92ze1pd2ia6FDT4JbMI0jYuBf+VM/YW4 0dgn0w0IBwmdJl4Q2h9bhwO8E+YdUmaKs58inb9b3HTkudueQkijzMCXxoafn/V8R4ns U9uu2IOslX1d8VWh7AQJuFvlEgiauYdyJIfkOWRq2hX9XcCP9LakDyhMyZ6Zo7Eglkb/ G/Iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 205-20020a6300d6000000b0055ba5bb0bd4si5763537pga.776.2023.08.07.12.35.45; Mon, 07 Aug 2023 12:35:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbjHGSV3 (ORCPT + 99 others); Mon, 7 Aug 2023 14:21:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231216AbjHGSVF (ORCPT ); Mon, 7 Aug 2023 14:21:05 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A7A0E5B; Mon, 7 Aug 2023 11:21:02 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.2.0) id 9ce1ce9819c4cc9e; Mon, 7 Aug 2023 20:21:00 +0200 Authentication-Results: v370.home.net.pl; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=rjwysocki.net (client-ip=195.136.19.94; helo=[195.136.19.94]; envelope-from=rjw@rjwysocki.net; receiver=) Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 1ADD46625B2; Mon, 7 Aug 2023 20:21:00 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI , Daniel Lezcano Cc: LKML , Linux PM , Michal Wilczynski , Zhang Rui , Srinivas Pandruvada Subject: [PATCH v5 02/11] thermal: core: Introduce thermal_zone_device_adjust() Date: Mon, 07 Aug 2023 20:02:57 +0200 Message-ID: <2154540.irdbgypaU6@kreacher> In-Reply-To: <4503814.LvFx2qVVIh@kreacher> References: <13318886.uLZWGnKmhe@kreacher> <4503814.LvFx2qVVIh@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrledtgdduudejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepjedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghp thhtohepmhhitghhrghlrdifihhltgiihihnshhkihesihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Introduce a new thermal zone device operation called .update() for modifying thermal zone components such as trip point and a new helper function, thermal_zone_device_adjust(), that can be used by drivers providing the new thermal zone device operation to invoke it under the zone lock. Signed-off-by: Rafael J. Wysocki --- v4 -> v5: No changes. New patch in v4. --- drivers/thermal/thermal_core.c | 20 ++++++++++++++++++++ include/linux/thermal.h | 2 ++ 2 files changed, 22 insertions(+) Index: linux-pm/include/linux/thermal.h =================================================================== --- linux-pm.orig/include/linux/thermal.h +++ linux-pm/include/linux/thermal.h @@ -74,6 +74,7 @@ struct thermal_zone_device_ops { enum thermal_trend *); void (*hot)(struct thermal_zone_device *); void (*critical)(struct thermal_zone_device *); + void (*update)(struct thermal_zone_device *, unsigned long); }; /** @@ -323,6 +324,7 @@ int thermal_zone_unbind_cooling_device(s struct thermal_cooling_device *); void thermal_zone_device_update(struct thermal_zone_device *, enum thermal_notify_event); +void thermal_zone_device_adjust(struct thermal_zone_device *tz, unsigned long data); struct thermal_cooling_device *thermal_cooling_device_register(const char *, void *, const struct thermal_cooling_device_ops *); Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -497,6 +497,26 @@ void thermal_zone_device_update(struct t } EXPORT_SYMBOL_GPL(thermal_zone_device_update); +/** + * thermal_zone_device_adjust - Adjust a thermal zone. + * @tz: Thermal zone. + * @data: Data to pass to the zone's .update() callback. + * + * Modify components of a thermal zone (for example, trip points) via + * its .update() callback (for example, after a platform configuration + * change). + */ +void thermal_zone_device_adjust(struct thermal_zone_device *tz, unsigned long data) +{ + mutex_lock(&tz->lock); + + if (device_is_registered(&tz->device) && tz->ops->update) + tz->ops->update(tz, data); + + mutex_unlock(&tz->lock); +} +EXPORT_SYMBOL_GPL(thermal_zone_device_adjust); + static void thermal_zone_device_check(struct work_struct *work) { struct thermal_zone_device *tz = container_of(work, struct