Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp516585lqt; Fri, 19 Apr 2024 02:43:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBXBD7ztXTE3FelkdIu0aUw7cpiUXyxYh59uavScOI1dOSjacnM1c40UMXe9z97NT9SZMcNF7y2tTlGHTLcS8AsHJz//Ok3amEEnS75Q== X-Google-Smtp-Source: AGHT+IEJOelKXfbZ7AUp86jPUghqFL8MMF6gLe/ocrxxkjjy0RaNEG1fvfLoijc4APLeUPAqnDmw X-Received: by 2002:a17:903:32ca:b0:1e0:b60f:5de3 with SMTP id i10-20020a17090332ca00b001e0b60f5de3mr2415407plr.7.1713519808495; Fri, 19 Apr 2024 02:43:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713519808; cv=pass; d=google.com; s=arc-20160816; b=FbvtA2a487R5ZqsTKfd/HmIHaey3Shvz2yFfPKMMP/7JdIfo4HeLp/A+5iPaFd3U1E zD+J0ku3nLi0aztv6e2XogW061X7vEUZbi/xNv9Xx3PoY4Br4nF37UIKOFpPbGt9xOjs jEX1m3/DqHjBwnn64m2htyDPZJk+irj81D7wb0fPg0igUANAfnErgYzBvlde9Z2i0ikn y7yWK40x7uwGhGl0UgV0JuyMgkjdoNQZpEolilaDGbDlGDKMzciKrLtFt8v2hMR0/0jV Hx6k64xlRBLvfRqD/Oj5ttzVhqs1Dnnv2jl67xw6fZY3ORlpCMBeoGoJR+h7tyVLo06T hWPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=s84CUSmp9dkM34fmhq8rpu+Irhnnik2XF4IR5jCjviY=; fh=NWbihT0n2LVGI0eIabKMMzs0D4KhesRC0I1HJGdvI0I=; b=LuQOt4SDEs8b6Mq2lZMln+vLPVGER+woldNlHZwiLON1XYS5bwL3Nd8D30SUBCatMd yWZqm7dRFrwYJjIT/44MB7qAaX1iuhCkxvECEAeqv0Mo+F/59LWQeR9Jrl6TpTboWI5B WUlpZvbDNKSUgg2p7KvMS9BuAEAMwhVz4nEW2uqCFxzJetsvutNWw4DGDiWWKPzQYpaD 87UMti0Vg4AiMGwYfGmD61XVMjeUWQec1rqhHlYPrM81W44pEpMme7g/vpnd7I7fEBLH t/XrcwaKVFNR5KTYFx4RjjVJ5jSg2+2xwmx5A5ob/wh+NTxqAyw0pTYLgOrDfRbPX39r dF/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-151243-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151243-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2-20020a170903230200b001e2abe09daesi3103122plh.303.2024.04.19.02.43.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:43:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151243-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-151243-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151243-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C541FB21D6C for ; Fri, 19 Apr 2024 09:42:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FC327BAFD; Fri, 19 Apr 2024 09:42:48 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C43DC38D; Fri, 19 Apr 2024 09:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713519767; cv=none; b=AZ9pQhGUGEqf9pD4fxJ6uG17M/9whRJVIyC1+P/Boy4hq7ZRNi1OgZXbfEVxUu5qcAiCCFPZYNHw1j3NO16P1OTzjOm0Bdohb4DtUbu081NuB7eM8AwUKMfjhGEHPz49ObVvNrrTOqPYUgrSDfv5s6n9t+j7jTRvwjSbc9zTkHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713519767; c=relaxed/simple; bh=LYzTc/eaLc+xLzg4IoyEUHl2csluo0qUvLDBP6KWlOs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=WPx41pkY4nEFQQa6AXbtE8YOzsnn6YnFhRHLmSvyGbYtbz2jtueW3Ak0zkJAW0IjDLCYjcVmiiyFZPLuR/KVgldTNRZ4Bnd/hEcTwvaf6GNyLv6fhkiN/1vGscftK3fvGDufPJR55EaPqOMKJYvXaxgmZ39GJB/XbfBlheyauWA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 578292F; Fri, 19 Apr 2024 02:43:12 -0700 (PDT) Received: from [10.57.77.69] (unknown [10.57.77.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 280F53F792; Fri, 19 Apr 2024 02:42:42 -0700 (PDT) Message-ID: Date: Fri, 19 Apr 2024 10:42:50 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 04/16] thermal: gov_bang_bang: Fold thermal_zone_trip_update() into its caller To: "Rafael J. Wysocki" Cc: LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada References: <13515747.uLZWGnKmhe@kreacher> <3827124.kQq0lBPeGt@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <3827124.kQq0lBPeGt@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/10/24 17:06, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Fold thermal_zone_trip_update() into bang_bang_control() which is the > only caller of it to reduce code size and make it easier to follow. > > No functional impact. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/thermal/gov_bang_bang.c | 75 +++++++++++++++++----------------------- > 1 file changed, 33 insertions(+), 42 deletions(-) > > Index: linux-pm/drivers/thermal/gov_bang_bang.c > =================================================================== > --- linux-pm.orig/drivers/thermal/gov_bang_bang.c > +++ linux-pm/drivers/thermal/gov_bang_bang.c > @@ -13,47 +13,6 @@ > > #include "thermal_core.h" > > -static void thermal_zone_trip_update(struct thermal_zone_device *tz, > - const struct thermal_trip *trip, > - bool crossed_up) > -{ > - struct thermal_instance *instance; > - > - dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", > - thermal_zone_trip_id(tz, trip), trip->temperature, > - tz->temperature, trip->hysteresis); > - > - list_for_each_entry(instance, &tz->thermal_instances, tz_node) { > - if (instance->trip != trip) > - continue; > - > - if (instance->target == THERMAL_NO_TARGET) > - instance->target = 0; > - > - if (instance->target != 0 && instance->target != 1) { > - pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n", > - instance->target, instance->name); > - > - instance->target = 1; > - } > - > - /* > - * Enable the fan when the trip is crossed on the way up and > - * disable it when the trip is crossed on the way down. > - */ > - if (instance->target == 0 && crossed_up) > - instance->target = 1; > - else if (instance->target == 1 && !crossed_up) > - instance->target = 0; > - > - dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target); > - > - mutex_lock(&instance->cdev->lock); > - instance->cdev->updated = false; /* cdev needs update */ > - mutex_unlock(&instance->cdev->lock); > - } > -} > - > /** > * bang_bang_control - controls devices associated with the given zone > * @tz: thermal_zone_device > @@ -90,7 +49,39 @@ static void bang_bang_control(struct the > > lockdep_assert_held(&tz->lock); > > - thermal_zone_trip_update(tz, trip, crossed_up); > + dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", > + thermal_zone_trip_id(tz, trip), trip->temperature, > + tz->temperature, trip->hysteresis); > + > + list_for_each_entry(instance, &tz->thermal_instances, tz_node) { > + if (instance->trip != trip) > + continue; > + > + if (instance->target == THERMAL_NO_TARGET) > + instance->target = 0; > + > + if (instance->target != 0 && instance->target != 1) { > + pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n", > + instance->target, instance->name); > + > + instance->target = 1; > + } > + > + /* > + * Enable the fan when the trip is crossed on the way up and > + * disable it when the trip is crossed on the way down. > + */ > + if (instance->target == 0 && crossed_up) > + instance->target = 1; > + else if (instance->target == 1 && !crossed_up) > + instance->target = 0; > + > + dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target); > + > + mutex_lock(&instance->cdev->lock); > + instance->cdev->updated = false; /* cdev needs update */ > + mutex_unlock(&instance->cdev->lock); > + } > > list_for_each_entry(instance, &tz->thermal_instances, tz_node) > thermal_cdev_update(instance->cdev); > > > LGTM Reviewed-by: Lukasz Luba