Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10966418rwp; Fri, 21 Jul 2023 07:24:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFEvk52VEwMZIbZxBYpR2Qjej/5SpSEuNZBIji2H/8Yml+khLutymVd6cFjEgM/NM+3+2R+ X-Received: by 2002:a17:906:1098:b0:989:34a0:45b0 with SMTP id u24-20020a170906109800b0098934a045b0mr1863841eju.49.1689949473316; Fri, 21 Jul 2023 07:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689949473; cv=none; d=google.com; s=arc-20160816; b=zYt5nq18GeEKWySqva+WJaNnvV75e6aAuMFA8cnQcBFoxb2d+FvZbrPZJKLzgSiwM+ CyOJP2TiJhKpBjyWV2FjUpzkf6iBxXfMEWIojER+65wnlLk2B+CMcgCATRRSfteT3DuU VkNCaJfrDUT29zDhqcxefZdmwnSid8Srtp55p2lERL1sVHv36vC7jauAIAFEYYkM7YHG xK/njcyXewzvQuMXWKM9IBnurgNDx+P2Cw3zrnPVrhC9hMLBQ6nmtniT2IINqv6CljKP 9KqTquRbPKz6sYJEwbJXROrgWx1CallbkepbohWls//W/poUkNGLT5wrR4s6sSSjSvxX p7NQ== 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=SsBewalBe1RiNmcuCBYmBzJ/DZOhpzyPilHyQlY7lvo=; fh=WAm0nkxw3rD71A4QzwJS1JiPPKRsyn91IiWMPsOrzoY=; b=s3TkI1lnb0dVG5EpKTqqNoS9a/jhFAMT2ncI8tv7lyImzXs7sLiiCV1vaBgVtjY3TT dsZ5r3+m8eHcnnJwUfIQD2LfKzHNC09gPEtQb5HQVldkV/e7AnlU9AHwWvMg70Je1b/2 X5vEQws+Mvke2t1+F7Vp/E8eeGWBUnM0KlzZWv44Hm7bY5bEB7hQV1MK5r6VFPySFRqK CxJ2yYWY3jvq8lo4KgAZiZiaaJ/Bg9nhq6saHxpYOjRcB0NF1h8mZ9lAMxKISk+4/yHr 2J54ohGsK5mbRsKvtEdJ0tO7dw0rtAK12rAg57xLd1IFh6F36fbW0d4vUJoo0yTjbgeg wDAw== 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 bm8-20020a170906c04800b009888b617ebbsi2027878ejb.606.2023.07.21.07.24.09; Fri, 21 Jul 2023 07:24:33 -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 S231733AbjGUOHh (ORCPT + 99 others); Fri, 21 Jul 2023 10:07:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbjGUOH1 (ORCPT ); Fri, 21 Jul 2023 10:07:27 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1ADD1BE2; Fri, 21 Jul 2023 07:07:23 -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 ff9927f48c58abfd; Fri, 21 Jul 2023 16:07:21 +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 DD54D6618EA; Fri, 21 Jul 2023 16:07:20 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Linux PM , Michal Wilczynski , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v2 3/8] thermal: core: Add routines for locking and unlocking thermal zones Date: Fri, 21 Jul 2023 14:50:44 +0200 Message-ID: <2167475.irdbgypaU6@kreacher> In-Reply-To: <5710197.DvuYhMxLoT@kreacher> References: <13318886.uLZWGnKmhe@kreacher> <5710197.DvuYhMxLoT@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: gggruggvucftvghtrhhoucdtuddrgedviedrhedvgdeikecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhitghhrghlrdifihhltgiihihnshhkihesihhnthgvlhdrtghomhdprhgt 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, RCVD_IN_DNSWL_BLOCKED,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 --- 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 *);