Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4388821rwo; Tue, 25 Jul 2023 05:32:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlHZyfdGNG4l1+lqL37p1G+zbuMwu80moKdYJxFVNdmlRLzicA6OxgMO5gacx19sVvy7mcUl X-Received: by 2002:a17:90a:3882:b0:268:1068:4464 with SMTP id x2-20020a17090a388200b0026810684464mr6119988pjb.30.1690288358531; Tue, 25 Jul 2023 05:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690288358; cv=none; d=google.com; s=arc-20160816; b=DJbbsjIcPWfTSToYK1nmhGhhUZFjXODGENMlqg/zB6hyAOFO8hP0KEfqV1RIiRq2wE aKZMjMvOVAeurtS9+ninhgKSPvirzJGMHG0lNw6eCihbBqHWdhSNVuKLDuufnxzLNcft CDCOtzOIA6wCJOk3GChm349KEocvYXXdgMwYSK7nk1fJs/ihVc9ysKV7hLq5QwhjSLjK NysjB4+Eb13S6Rpg6hs0ynWWpOwk0xkF8IHEbXTMSS9vxuPVPifu0Is6HnhkI7VSIcrP UAx0bj5IjScvXBKfqj0PvZl9Xy+JAVB/Fnj80mdoH7D6zsZqla0waLot3Ko1RzKhSrr3 XUgA== 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=alSq7BdOaSsBYMfAPzfpgZZ7ZOKbiiZNSa0ZsR49irw=; fh=WAm0nkxw3rD71A4QzwJS1JiPPKRsyn91IiWMPsOrzoY=; b=TZ+h70DiXDx6yaWDw1Wvw6dWONKmuYKQu3e/pZdj471aNAv9pJgMe7T2G6YUwniyAq mRBgtpw+b+kMbidLB8g9bjrm95rnxOoBLGF8bIXCHZJRdUQKeVPBVqJW/iNzVf/cuPV6 LtAO6DYgvPVtlAIFZJi8C54LgalHKote+EFKbHAGpfRGxgA3Zo3hgA0OuaCalmAYUMXH 97LEkjfMSkwIngTc5oIMHSxwjwD8oJbvHnvLLIZZw+fPK9hN+XNlxIlMVR91i2aZ4XKD tMPfH39hRhR2boEwssgCKzZVElDN35XLFanDekjnd8DqW6cmnEks06wOmPWaK17xpLqP QVPQ== 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 s12-20020a63924c000000b0055c66f42ee9si11039309pgn.803.2023.07.25.05.32.26; Tue, 25 Jul 2023 05:32:38 -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 S233701AbjGYMZr (ORCPT + 99 others); Tue, 25 Jul 2023 08:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230424AbjGYMZe (ORCPT ); Tue, 25 Jul 2023 08:25:34 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C181E7E; Tue, 25 Jul 2023 05:25:32 -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 a9f50b1ffa9a852c; Tue, 25 Jul 2023 14:25:31 +0200 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 BD62E661B0F; Tue, 25 Jul 2023 14:25:30 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Linux PM , Michal Wilczynski , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v3 3/8] thermal: core: Add routines for locking and unlocking thermal zones Date: Tue, 25 Jul 2023 14:08:02 +0200 Message-ID: <2154273.irdbgypaU6@kreacher> In-Reply-To: <12254967.O9o76ZdvQC@kreacher> References: <13318886.uLZWGnKmhe@kreacher> <12254967.O9o76ZdvQC@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: gggruggvucftvghtrhhoucdtuddrgedviedriedtgdehtdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhitghhrghlrdifihhltgiihihnshhkihesihhnthgvlhdrtghomhdprhgt phhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh 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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Add thermal_zone_device_lock() and thermal_zone_device_unlock() for acquiring and releasing the thermal zone lock, respectively. They will be used by the ACPI thermal driver to protect trip point temperature updates against races with accesses from elsewhere. Signed-off-by: Rafael J. Wysocki --- v2 -> v3: No changes. v1 -> v2: New patch. --- drivers/thermal/thermal_core.c | 13 +++++++++++++ include/linux/thermal.h | 2 ++ 2 files changed, 15 insertions(+) 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 +498,18 @@ void thermal_zone_device_update(struct t } EXPORT_SYMBOL_GPL(thermal_zone_device_update); +void thermal_zone_device_lock(struct thermal_zone_device *tz) +{ + mutex_lock(&tz->lock); +} +EXPORT_SYMBOL_GPL(thermal_zone_device_lock); + +void thermal_zone_device_unlock(struct thermal_zone_device *tz) +{ + mutex_unlock(&tz->lock); +} +EXPORT_SYMBOL_GPL(thermal_zone_device_unlock); + static void thermal_zone_device_check(struct work_struct *work) { struct thermal_zone_device *tz = container_of(work, struct Index: linux-pm/include/linux/thermal.h =================================================================== --- linux-pm.orig/include/linux/thermal.h +++ linux-pm/include/linux/thermal.h @@ -336,6 +336,8 @@ 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_lock(struct thermal_zone_device *tz); +void thermal_zone_device_unlock(struct thermal_zone_device *tz); struct thermal_cooling_device *thermal_cooling_device_register(const char *, void *, const struct thermal_cooling_device_ops *);