Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4737762rdh; Wed, 29 Nov 2023 09:15:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEn8FVsrBOEe/JI1GbB12pv47F9NzI5GrnJkNquj8ha+IZNoQqL8gp7WvoAb9OgseD5y5Lt X-Received: by 2002:a05:6a20:3d1b:b0:18b:556b:6d54 with SMTP id y27-20020a056a203d1b00b0018b556b6d54mr22092136pzi.55.1701278104463; Wed, 29 Nov 2023 09:15:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701278104; cv=none; d=google.com; s=arc-20160816; b=mIasXRNmWaLXHPI7x67Kj231dv0IUUaR1McgfhKr2lHeP4pL+htjJguqrmbNJFIRV3 3mh11n7M2EJ60AuAK+lT+/+8TRyljsrbYoEpkajS4n1ZhN+HA8ZJe4229T64+QJBywb5 XFC7aoXGi5r7xO2zxVqXLWpj0CB0BXAquRHh89anHQEhW295ZcuJ2bZTGo0C4+GHSsrK MMiFlkyK2lEU4cctBbrzP5Uji0hYtjf9akNm/NLr+Y4AlDxeOg7uileIWISsKWfxDskN VgyuWS8JnSmYo3u/dNP5QmWm6bWnK+UJyxx15BB9G8fGpNq66ijiuMiCr2iJduQUckAd +jjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=KmtEttLhDKjBXTKhw+UBfoDJvqyx2rM+HgR4pssYE/E=; fh=RjkRc/FhKx0ouKQ9JcARy/W3YEos4nBH55yWPTBs/m8=; b=ZAhy/oxfjffRGDOHyq9pmtZbi6isu80lsdJ8mJG5il1Vh5FS/dhxIQXCRS8u/NZ12w lGUNRWRdAUpgldr0CPlwQmAj4mY7tnFNzPUN48rQ6KHTuQabKCND7sXjlJhhMk8XhtMs YhuK6rJqyD55I3BihxnhLUvSbOihxgj0KRlYHNwMEAvYpQ3K6YZ46Xd4kloTkjbD9PZW CWgPKaYRXAmeQstuZkoxOQMDzsrzPokYphEwoOhSi86gqxQeWJ61ZVymFFLQSP4lBrkw tskXp0CUbOjdIyEovuYyv1spb2n2TkioHyiK3WndMvSw6QRwECsPIKExjPdJc2rG2dSm BDqA== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o126-20020a62cd84000000b006cdd1aed274si1645458pfg.349.2023.11.29.09.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 09:15:04 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C3295803F95E; Wed, 29 Nov 2023 09:15:01 -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 S231520AbjK2ROe convert rfc822-to-8bit (ORCPT + 99 others); Wed, 29 Nov 2023 12:14:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjK2ROd (ORCPT ); Wed, 29 Nov 2023 12:14:33 -0500 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D573B2; Wed, 29 Nov 2023 09:14:40 -0800 (PST) Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3b85d97a529so940777b6e.0; Wed, 29 Nov 2023 09:14:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701278079; x=1701882879; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0BTxP1AwTzLXl5jDe0Z7kCtR7I/vrVTah70CPbLH4S0=; b=FAfXAdaC80+Q/W/LPYt8abxZi3DZ7wHCIrgb8ekJsIyBipBlFS+0F94bWGg2zEmybm LVUGyKJ/B6XfYL+2ZIvrinnaEHM2ivItn2bYGt179Yhu+Obg0myMlz1WzabNYERqKuqo xpR9aLdsjpOdNlrXOUDb9K8RauNFJttlDHGA22bGhaNetglJKMlxU0EuKFBW1aYGe7QG 6hQ+B5e1aCx1YtriwbdKFztdKSdFin5YiZPX3a9SJQp7ACSwPOHmFlaxp1dHmPIUEmnw BD847Ozc3VMJnCftz15K6sc6wazscd4mSyi1FsEVv4u0XesEulYkjX8dhaV05iJP8FwG xVhQ== X-Gm-Message-State: AOJu0YxKumvjeaZL/H3TEY3s+ghfB47PAkrtqpw0O6opCs9dPELVBylz 5mKbrJTyHI1WNgPMF4UnVLNYWNFvKoApdHZxUwum78e1 X-Received: by 2002:a05:6808:d1:b0:3ae:5e6a:5693 with SMTP id t17-20020a05680800d100b003ae5e6a5693mr19467747oic.0.1701278079477; Wed, 29 Nov 2023 09:14:39 -0800 (PST) MIME-Version: 1.0 References: <12350772.O9o76ZdvQC@kreacher> <4869676.GXAFRqVoOG@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 29 Nov 2023 18:14:28 +0100 Message-ID: Subject: Re: [PATCH v3 2/2] thermal: trip: Rework thermal_zone_set_trip() and its callers To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Linux PM , LKML , Srinivas Pandruvada , Zhang Rui , Lukasz Luba Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=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 09:15:02 -0800 (PST) Hi Daniel, On Wed, Nov 29, 2023 at 5:54 PM Daniel Lezcano wrote: > > > Hi Rafael, > > On 29/11/2023 14: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. > > Please hold on before merging this change. I've some comment about it > but I have to double check a couple of things before That's fine, but why don't you make the comment before the double checks?