Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp523517lqt; Fri, 19 Apr 2024 02:59:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXPtkYGBkccK/PedL/2ddd1EF6AOw5SR8NFsqAleEEeaPxtcHany0IzSwfrA6XWIxZScj9URp1+mM5jFahSx9z7BZMkmQ5VV9PaUmED4A== X-Google-Smtp-Source: AGHT+IEoFlezsPAOf6H5BsEMLsqyOHNlyn4VXvumygam2FO/J+22x+rhnRDwYxdoOpA7mlcjZiD7 X-Received: by 2002:a05:6a20:5505:b0:1aa:5e75:d31f with SMTP id ko5-20020a056a20550500b001aa5e75d31fmr1557100pzb.16.1713520785211; Fri, 19 Apr 2024 02:59:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713520785; cv=pass; d=google.com; s=arc-20160816; b=XCnwEQrEy8XJNqFNdFKpCgeVa4HDvoUzodqNZnt3HE1UvQD36+RTkYo5Qsri3x6QbP wNEnWhi/UcQTDzfYDf9mwyb9ihFtCdXacBrgPeGI8+2HUab3J2937HmGNiaTqjA2hKVq +V81nENyCyiZ3lmB54252LgJ7XcY17bXC5MOHjuO9wdzoRTaolWwjLvzjTZPAr8QP3lI OogbOQZ4Z22/00b8uOwvAblBPbYE2f93iWUCIsYJUtMPqDyJ3i+six8q05LWpJUm5NI8 JI7cCFSA2EYIAGXhOcpfepdIjCQ1Ik74IO281iYBPCnFpXYgtTDzgLc+PjUOi54bwFKi GneQ== 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=BLAauXDk7D+4YGXjbPI/wvlLnjhwOwIdW7U4TCxSjZw=; fh=NWbihT0n2LVGI0eIabKMMzs0D4KhesRC0I1HJGdvI0I=; b=JSrDzGZl7eOqD/CZTU9fXaKadvSr+7lNP8I3bWQtayyx0tHtcOZ7IWOjN5sV3e4bC0 Kid3zCUFWigLFFsTnjEYFcHSywCevzuRUbddS6t+mN23RtZypYp3nAs6OhxjA3LMMozh BF4nO9tlW4hKnLPbbXTlKYQrOTpNdMtp/43WqUOeRhM8kbLAGLpthqW5J/tM/AWF6sPQ mGHry+Z0ZiSYFY06Q+Jb+NK9RMkE6oAqZzwEMrfjdoP8Xb8WNhsI6Hi/tMaJwh8oQmW9 UYuoF0Zojl8ss6x8xaTyhnBzceEFaUH2UAP69zJTI2nzmZnmN4nHUKz4DZWu/HambkvA wD4A==; 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-151276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151276-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t9-20020a17090a448900b002a4ca589e67si4615947pjg.53.2024.04.19.02.59.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-151276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151276-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 68B56281C1D for ; Fri, 19 Apr 2024 09:59:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF2C58172A; Fri, 19 Apr 2024 09:56:45 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA5A37C081; Fri, 19 Apr 2024 09:56:42 +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=1713520605; cv=none; b=NzHhVE0JNiTSc4OeKoJlzS3gFQdKNrSKEq7U7jwAzhpZkw4IaCyO4fP97fvNR2YNZ3LCKdDQL18+sx9NKaHuT9Zy3aR/XH7cwoi1zK6Zpg1H2va0Q6OmUNErqWPyHzQlVktx3t5gdi5gfuKXuKblhUfzpZEJeAHhKv3ZMAlikoI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520605; c=relaxed/simple; bh=J3ax+lMVj12rToXsUM/WDkLNIOKZs1F4BILE6ioPOQs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XmBWR7VXBvTpWNrdg5IDdN6tb1zwttg4pAXNTFcmeM82CKOqa0x1GeTH23OGC2USkvVTp7ISMPKDR0FQ4Th8avtDxr2tnjGiAZ8cDVXL148DGIX8aF3FbGU+KKBkqoj5gmZ7kG+722/a1bCLfqIMLluqjMiSV55OMwKxkbzNLlo= 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 559E62F; Fri, 19 Apr 2024 02:57:10 -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 21F7A3F792; Fri, 19 Apr 2024 02:56:40 -0700 (PDT) Message-ID: <3e23d9e5-001e-4f89-80c4-68e36fb756dc@arm.com> Date: Fri, 19 Apr 2024 10:56:48 +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 07/16] thermal: gov_power_allocator: Eliminate a redundant variable To: "Rafael J. Wysocki" Cc: LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada References: <13515747.uLZWGnKmhe@kreacher> <1913649.CQOukoFCf9@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <1913649.CQOukoFCf9@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/10/24 17:12, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Notice that the passive field in struct thermal_zone_device is not > used by the Power Allocator governor itself and so the ordering of > its updates with respect to allow_maximum_power() or allocate_power() > does not matter. > > Accordingly, make power_allocator_manage() update that field right > before returning, which allows the current value of it to be passed > directly to allow_maximum_power() without using the additional update > variable that can be dropped. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/thermal/gov_power_allocator.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > Index: linux-pm/drivers/thermal/gov_power_allocator.c > =================================================================== > --- linux-pm.orig/drivers/thermal/gov_power_allocator.c > +++ linux-pm/drivers/thermal/gov_power_allocator.c > @@ -747,21 +747,18 @@ static void power_allocator_manage(struc > { > struct power_allocator_params *params = tz->governor_data; > const struct thermal_trip *trip = params->trip_switch_on; > - bool update; > > lockdep_assert_held(&tz->lock); > > if (trip && tz->temperature < trip->temperature) { > - update = tz->passive; > - tz->passive = 0; > reset_pid_controller(params); > - allow_maximum_power(tz, update); > + allow_maximum_power(tz, tz->passive); > + tz->passive = 0; > return; > } > > - tz->passive = 1; > - > allocate_power(tz, params->trip_max->temperature); > + tz->passive = 1; > } > > static struct thermal_governor thermal_gov_power_allocator = { > > > LGTM Reviewed-by: Lukasz Luba