Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4886268rdh; Wed, 29 Nov 2023 13:42:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvmpYlju/tcbxwvqQyk4A3r6HRkKf3FTPz38iN84pw2lmdg9z90SnCiQgN3qPpfZSind2p X-Received: by 2002:a17:90a:188:b0:285:d7db:a9de with SMTP id 8-20020a17090a018800b00285d7dba9demr10283196pjc.41.1701294162885; Wed, 29 Nov 2023 13:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701294162; cv=none; d=google.com; s=arc-20160816; b=dQyfjgyJBcWCwVvPOxb6y+VaRjenWNcScyr4OifBO1ENH9gBct1MWoitOpcvRUhNR0 T8oaiDhLeaYkUEI+yLjtS0oj2UT7n4Cjve80j+A8G0RDnlsFYCyqkQhm6wLLIw17Jfyd wDZkeUVkVJVBYgEFL/g1QKxWdOJEQdyC9USGA/M7M31f5tdc0LpgCLF4EruKvLNRUDyH oes85OOSlGwfU9y5QtwPJq6C6ETjQhTxpjtWJ+eJODxqh5cHQJsUoJfA70xy1V3G3nTx UVMp7mxO7LoydtbpNrO6JgGbBlsaEgwtDm28WuphaPTAxvVJPLwsJcRPXxA2wSpZZqlV wJmQ== 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; bh=/TkcJD/fGj198TlzeL1jeHVX+Bt6s8eTQXCi5wAyCXw=; fh=Ti+l9dN1V1s4/No4+jOTAJr69T5zUPbby9cCUyZHH/o=; b=rP4w4AQaR65Hm24sHizXllWdvFhv1w09QLOSvN0r+FM8XHIaT2QCbKD/n1UACsRHiu hamVufV4jqb4kOwWqZ4aB1yEaoOSCKDUvw4X3r93ji9wgHH+MLeXNMjTKb1N3Ujg1GVE gkrI9W/7diVcr5sOjfv++Kxo/IgJm9iu6CcvWV7bqp09esjPo5Q4lanJBSl+neXPobkX U/XYnDq1BUzO08Yhr9y+7vA+luwiZ4Cu4xsUP5A+4x1md0UyXcupuLzPaHWv/nFVY32a FKQId2QF60JYG73eWz0Z8qRYlmXec/OEZmfo6cuTqBiq1zYFIkVvobZ0OP84+tNfqGEu nu1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id mt15-20020a17090b230f00b0027749a1fe74si2044934pjb.182.2023.11.29.13.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2E11B80BB3C4; Wed, 29 Nov 2023 13:42:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbjK2Vm0 (ORCPT + 99 others); Wed, 29 Nov 2023 16:42:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbjK2VmZ (ORCPT ); Wed, 29 Nov 2023 16:42:25 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 141598F; Wed, 29 Nov 2023 13:42:32 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B9CDFC15; Wed, 29 Nov 2023 13:43:18 -0800 (PST) Received: from [10.57.4.241] (unknown [10.57.4.241]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A69E23F5A1; Wed, 29 Nov 2023 13:42:30 -0800 (PST) Message-ID: <7cdce766-7bec-4654-9727-2313b466b14d@arm.com> Date: Wed, 29 Nov 2023 21:43:30 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] thermal: trip: Rework thermal_zone_set_trip() and its callers Content-Language: en-US To: "Rafael J. Wysocki" Cc: LKML , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui , Linux PM References: <12350772.O9o76ZdvQC@kreacher> <4869676.GXAFRqVoOG@kreacher> From: Lukasz Luba In-Reply-To: <4869676.GXAFRqVoOG@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 13:42:40 -0800 (PST) On 11/29/23 13:38, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Both trip_point_temp_store() and trip_point_hyst_store() use > thermal_zone_set_trip() to update a given trip point, but none of them > actually needs to change more than one field in struct thermal_trip > representing it. However, each of them effectively calls > __thermal_zone_get_trip() twice in a row for the same trip index value, > once directly and once via thermal_zone_set_trip(), which is not > particularly efficient, and the way in which thermal_zone_set_trip() > carries out the update is not particularly straightforward. > > Moreover, some checks done by them both need not go under the thermal > zone lock and code duplication between them can be reduced quite a bit > by moving the majority of logic into thermal_zone_set_trip(). > > Rework all of the above functions to address the above. > > No intentional functional impact. > > Signed-off-by: Rafael J. Wysocki > --- > > v2 -> v3: Fix missing return statement in thermal_zone_set_trip() (Lukasz). > > v1 -> v2: > * Fix 2 typos in the changelog (Lukasz). > * Split one change into the [1/2]. > > --- > drivers/thermal/thermal_core.h | 9 ++++++ > drivers/thermal/thermal_sysfs.c | 52 ++++++++-------------------------- > drivers/thermal/thermal_trip.c | 60 +++++++++++++++++++++++++++------------- > include/linux/thermal.h | 3 -- > 4 files changed, 62 insertions(+), 62 deletions(-) > That looks OK. I have also checked those places were we set the callbacks. In mainline we only use set_trip_temp() callback. I don't know what is Daniel's idea for the patch, but LGTM. Reviewed-by: Lukasz Luba also tested both patches on two arm32, arm64 boards Tested-by: Lukasz Luba