Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp146982rdb; Wed, 20 Dec 2023 08:25:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcl3TRfOhTUkEtWAyOW/0a61kJIsQt/XzRSLRJsvYruxFOT6bABeDPpMf1x2ZEEqmQX6Ni X-Received: by 2002:ac8:580b:0:b0:425:4043:7655 with SMTP id g11-20020ac8580b000000b0042540437655mr27228065qtg.125.1703089517090; Wed, 20 Dec 2023 08:25:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703089517; cv=none; d=google.com; s=arc-20160816; b=XUpZVRZ+xS5TnmlPhEQo9jkz0ZJ7MwdyuCpJ+JlcyrFESI3IzkQeL9bTF3jG8HEJ89 2mFKZC+f2gPOhN59a6bmbxBZKHkewl9Por1dsR55huqwmyMCBlsKUx6N54f85kbEDChs P61+C8PIPZgaQS2P341ZN4V1Tw+QMruKlxlfmiVAukNCDFw1wLgth8IpjEyCfA169LNj RKbHiipWSKTSKC6K0sjybxX8aMOu0VI7MGVbyiU3SIV+UzJNf1UUUEvMSCzebzjcSKg2 JFu5K9JRWBBvq9UVI6fGpjI/f4+8ibjvZCmqjm+b1UBCZuxfNyKux+Qm5wY1TqmOONm2 LTFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=iL5Memx3huK0bvuVQyXKthFMws0liptp8aWT2Zax00I=; fh=s+3ccwKL/Xc2i8uH9tAeSOb9IGpvLhPrVmnBNs/vSzQ=; b=sn4ZeVG2tSx1J2kDRWruxHHFOJWpQKmLZMiVvlJhCUsrXzWMIlEuLIUmkSNRhaAVqu RcUHQiY+0JhVqajFoirkgKIUGqmpBMFWtG0Qb7MLv5pV0ZbjhsFbHFxAGJcB6XKuDW+Z bBNDxJ56o4wnDk+tp2svEHhAo3R1I6vfbOS7WIE/7OHSVDEzVaffaRRdzrIFlHxWaw1b Y/CzMVJvayQCtDO0WbChT0Ivo0w+i5ppVnFkW9bm7t+Rq9hwKPeMLdx1X/1x/+kD6MgA qVuLwmKLjaFkFtpLZOL+X+RskxoyJPTJxfJia3H3JfWXuu2DP1Yzw4O2Wsr9KgphLr/v tQOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7284-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o18-20020a05622a009200b004259f6d6ed4si32486qtw.203.2023.12.20.08.25.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 08:25:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7284-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7284-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7284-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D5F821C21BD4 for ; Wed, 20 Dec 2023 16:25:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 090B141C9E; Wed, 20 Dec 2023 16:21:18 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53C5741854; Wed, 20 Dec 2023 16:21:16 +0000 (UTC) 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 968951FB; Wed, 20 Dec 2023 08:22:00 -0800 (PST) Received: from [10.57.82.217] (unknown [10.57.82.217]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CBD4B3F64C; Wed, 20 Dec 2023 08:21:14 -0800 (PST) Message-ID: <3f83b7a7-b674-486f-889a-033f550f3654@arm.com> Date: Wed, 20 Dec 2023 16:22:22 +0000 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 v2 4/8] thermal: gov_power_allocator: Simplify checks for valid power actor Content-Language: en-US To: "Rafael J. Wysocki" Cc: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, rui.zhang@intel.com References: <20231212134844.1213381-1-lukasz.luba@arm.com> <20231212134844.1213381-5-lukasz.luba@arm.com> From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12/20/23 14:40, Rafael J. Wysocki wrote: > On Tue, Dec 12, 2023 at 2:48 PM Lukasz Luba wrote: >> >> There is a need to check if the cooling device in the thermal zone >> supports IPA callback and is set for control trip point. >> Refactor the code which validates the power actor capabilities and >> make it more consistent in all places. > > This really is about reducing code duplication which is worth > mentioning, so I would say > > "Add a helper to check if a given cooling device in a thermal zone > supports the IPA callback and is bound to the control trip point and > use it wherever that check is needed to reduce code duplication." > Thanks, I'll use it. >> >> No intentional functional impact. >> >> Signed-off-by: Lukasz Luba >> --- >> drivers/thermal/gov_power_allocator.c | 41 +++++++++++---------------- >> 1 file changed, 17 insertions(+), 24 deletions(-) >> >> diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c >> index 3328c3ec71f2..1a605fd9c8c6 100644 >> --- a/drivers/thermal/gov_power_allocator.c >> +++ b/drivers/thermal/gov_power_allocator.c >> @@ -85,6 +85,13 @@ struct power_allocator_params { >> u32 *weighted_req_power; >> }; >> >> +static bool power_actor_is_valid(struct power_allocator_params *params, >> + struct thermal_instance *instance) >> +{ >> + return ((instance->trip == params->trip_max) && > > The inner parens are redundant. OK > >> + cdev_is_power_actor(instance->cdev)); >> +} > > The part below LGTM.