Received: by 2002:ac8:678b:0:b0:405:464a:c27a with SMTP id b11csp9422qtp; Tue, 1 Aug 2023 12:03:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlEmwpidYg0V7D2JnMuokBQ/vnG6OKg/Etvw1t83m+pbGxLXvvuhe/50YwPRtxwFBnXjiOgr X-Received: by 2002:aa7:cf8e:0:b0:51e:1643:5ad0 with SMTP id z14-20020aa7cf8e000000b0051e16435ad0mr3195229edx.8.1690916599070; Tue, 01 Aug 2023 12:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690916599; cv=none; d=google.com; s=arc-20160816; b=vTZPNzMBkZadU5tmQltSkePv8ibIxI2ki64gOwyPi7i6eBm97Pl/wTTNTBIfgCGvOn nLT7+N4o7o9zynkPUd80iLUjhvjDdDJOi6IxfDIRDP5P70OsflkEtkKhyGEeXXEZa5uj s34s73cprNfflIALh9GBfmZcZGwj1N41xYvVduDubJEl7YOT1t8OSGUVaGu4UkI4p1VJ UY9rsDecbQf38kmnqI8SAT+ebWa1JCf6R1567SXzLRuLYDNKbXP2CGa8CXOf4bcf8Bgx FJ9BgetFIUx1bln0He/iMwp1LbfrAcsw9f3M/knXOmKt+fP2Lz5gW0Fql/alaEu3TeMq gCig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=qtcJ9ghphdBZwkfQ1OoT+M+9vhYvFrLEL4xzG7btVFo=; fh=pEzMByEnePV36x3XCCNauQuREaASp/TIcmpU1ppDINA=; b=T+bTAzWkKCy9UJXRrWu7buNy80RyLhF/9zoJWQhVJSScnz8uDVnCIXrqi26UNDbd+A 542iKH0f0DRCaqoeVnUHVupTB6/EodSBmo1MsXqX9UHJ2NcKSK3LfsvnvS0nMgnM35E1 gWVlxL96XzWB6FwJgZ/ssoGNd1NQ/3OL2wo2W6+ZVWV2RgqmrH7VYLCTMvwqA0TyK9L6 D2TLLmD39lYl76BtlmiLYp6L2uj9x0xfD/cO92swDj7KOANddsvwJCLXnt4Wl7AIgguZ OQvZ2Q0RmBdrRwDB7AtJEGDGZUpQI0LceTlSoTVO/IL2RP3WsM2YuNoOZtxnk0Yyvg6W uM5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sP/ptIqw"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a056402078800b0052279c57c79si8539479edy.341.2023.08.01.12.02.53; Tue, 01 Aug 2023 12:03:19 -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; dkim=pass header.i=@linaro.org header.s=google header.b="sP/ptIqw"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231593AbjHASap (ORCPT + 99 others); Tue, 1 Aug 2023 14:30:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231733AbjHASao (ORCPT ); Tue, 1 Aug 2023 14:30:44 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF421BC3 for ; Tue, 1 Aug 2023 11:30:42 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4fe3678010eso4026208e87.3 for ; Tue, 01 Aug 2023 11:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690914640; x=1691519440; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qtcJ9ghphdBZwkfQ1OoT+M+9vhYvFrLEL4xzG7btVFo=; b=sP/ptIqwzq320rciKX8vLog6wBk7RDLYTE+D2RCyPHxqlK+WP+Zr0gtrPLUsOPp/En GAU2ZTWtxKHHeCaeAS5RBPwslOHggZ7261InGNiNAQwC3tyCM4OpIKYcK0IDCY3AW4e1 5c1+a5OnTt7s2N7Vx3CldBTDMJkLQ8eLJs67u6BImvvOPdLqEhJtDzZiRU3ASaLIPKFA 0TXRsFif89XW7wkt9qq+NG1mQwU1D7bPstys7ftjTaDBpKtLdlQOTUnDZw3r5J7ow6d0 NcHTrBkqDJ7gtlwxSkqf1Er+bURNcrmFg+uOso1zrQF4hDzcNQuR5WRv4c7+JrK3i53R Bm5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690914640; x=1691519440; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qtcJ9ghphdBZwkfQ1OoT+M+9vhYvFrLEL4xzG7btVFo=; b=J5y0cQsRtlxj8mSdSdSN1L3POCp7RfdNWlFlGI4dLL1vnoH3KalhmCpsKwwvx+NGGp kc9+iO1zapP4fPpV7HlC9HcldBlyKXs3sa2OcxQqz3WP9H5UgcfR+JB8fq+mYrS4fiEH ND0elZij+oVAMltpfYWvUJTLTvlNAqbMvW3HWU7JfzbKDZlj9tA4hLHDauiqdHbJL8Vd nrExqO0RStjq6r5dksHcauysfwr8j2p21wiDitpFRrShMGjv8jsZIzGfuZKf/InBgawD 7cTwHIaFynqJidgKw7U+Op+BCB8ueEnr3viE8C4etVN8FNoQ4gOe1twosefrr3Plbh4N 5m/w== X-Gm-Message-State: ABy/qLYfFklxZ1t9jd+se8F3ZA2vAakQfEQDqRaDvU1aejCOV9HINLJ1 0yIq6fohF4/XG9R6kX0eqUUqaw== X-Received: by 2002:a19:644c:0:b0:4fc:3756:754e with SMTP id b12-20020a19644c000000b004fc3756754emr2513770lfj.56.1690914640049; Tue, 01 Aug 2023 11:30:40 -0700 (PDT) Received: from [192.168.10.46] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id m7-20020a05600c280700b003fe1afb99a9sm8646959wmb.11.2023.08.01.11.30.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Aug 2023 11:30:39 -0700 (PDT) Message-ID: Date: Tue, 1 Aug 2023 20:30:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v3 3/8] thermal: core: Add routines for locking and unlocking thermal zones Content-Language: en-US To: "Rafael J. Wysocki" , Linux ACPI Cc: LKML , Linux PM , Michal Wilczynski , Zhang Rui , Srinivas Pandruvada References: <13318886.uLZWGnKmhe@kreacher> <12254967.O9o76ZdvQC@kreacher> <2154273.irdbgypaU6@kreacher> From: Daniel Lezcano In-Reply-To: <2154273.irdbgypaU6@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable 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 Hi Rafael, On 25/07/2023 14:08, Rafael J. Wysocki wrote: > 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. This change goes to the opposite direction of the previous thermal zone cleanup and encapsulation we have done recently. Here we give the possibility to a driver to act on the thermal core internals. Ideally, we should see tz->lock only in thermal_core.c > 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 *); > > > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog