Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp72952rdb; Wed, 20 Dec 2023 06:40:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLL5Z7QakMpbiKJdcfsK6kGRNfWtHQtYR43TYn7+akwkFZKbpR3hPta+PbgOCyS6xho1a8 X-Received: by 2002:ad4:5c6c:0:b0:67f:7789:13df with SMTP id i12-20020ad45c6c000000b0067f778913dfmr394277qvh.71.1703083226708; Wed, 20 Dec 2023 06:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703083226; cv=none; d=google.com; s=arc-20160816; b=hWJXuvt1thHVmesPkhuDIL4gFZAPQY8KI61yt2HSgzC0OMM7dAVoNDKeOH4lSoADDq oEWCrGyZjGGZrCcTzsG84Jbzf9DISZj6yjpb29Pkt9A1TfTpsoWMyRQER+WFvlUnGMj1 JSBY9oCqov97BI7qXyNZO432fcYBJFHn49GAzEquANdIwjqHIH0ioAQ213sJokPUSdpw pqQ2vTS1d75iJ1f6eGBNnXgHEaSc4Nf4G42gaKYlbO4C7+nyLn1UFrBuz8F5Cl9IwIks stwPxezjxEjKKVTwotO84AMhLfLrx2P+PkhAl1ZCId9x9VnjUbhkB6yLNXI4lOSH3vfW Iv7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=0uPEe/PvV2yyHocYnPwV3SYIncthg+F3eKBKwNYbXFU=; fh=wkSuoy5b1EIMGYEcqvfC1yBGuiIWNqkyE3KOqDLfZ9I=; b=fjb1BMQbdW0F+HQtuSzVBfnKCK3aKQ+H81so4vYTkQJGmo/YMvSP8Xxriknb0k2tG9 MqTNb7rvQ1sLaxSjeUpY9ATDduDu2xq3WKuq56kM2weK35bW3RdSplAKZFdomIWL6ePm A7uUpkF9f0E+gzAbiJcIICI4VVS5MKgHYBLReeSTtwK4A+N2JsIYqpkIXMHR0U72tLq7 mpQE3ZHEF+6/KqSz0Q3GgVu4T1rACGs0SJK3M5mFodX8aIT/Sfs02/Z4I1nFHv9k1hRr YxbvLkorX+RN3N3PgPQsaWWfERg5jn4QRBLjsaqbsuPHN9qMr4ITMPL/v2o4uNOH+cg8 62Wg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m16-20020a0cdb90000000b0067f0c7bd16dsi9472257qvk.162.2023.12.20.06.40.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:40:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 73DE61C223C8 for ; Wed, 20 Dec 2023 14:40:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 655B33D3BF; Wed, 20 Dec 2023 14:40:20 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8BA83D384; Wed, 20 Dec 2023 14:40:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-594172c5785so2789eaf.0; Wed, 20 Dec 2023 06:40:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703083218; x=1703688018; 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=0uPEe/PvV2yyHocYnPwV3SYIncthg+F3eKBKwNYbXFU=; b=ERjpMnXAbGc7CalrihyKkmTMRFzM2m0GQuibC0yF8GoLpBbYH6L737CmlF3q+wQLrk Yl8VwiMgQSIUSQafGG3+04SE31gfc2sdINBe4fvFwH2WjSsO2RNbiLgPMwr/qCTf3Oyb OLQVtrXXLnajndFoQqqA+LhMcJ/DmiJIK2eh5yen48JqEPKGt0owjPmkMpnBXCIHL+Oe 5TkW5atcOeF2Durlqgf7KVMH6GUjcs4qmy6UwgfwhCahCtbufdMaybPj9pCejPBgKxdn h8pNYMwKdR01iujaa0IGlXydjYgv4zVgBDIA0A7n2QG61lAwKeSmNVSf5CQsXyxP7GnM HASw== X-Gm-Message-State: AOJu0YwZmRfuY9ERCvU9wJBRFi2hISOmBjbfmVBSJgco1FaJgW2VMP10 V/CzXC6OeTo90On4VRjdmC77jmA/3kUMiwjypGQ= X-Received: by 2002:a05:6820:2484:b0:591:4861:6b02 with SMTP id cq4-20020a056820248400b0059148616b02mr23018350oob.1.1703083217730; Wed, 20 Dec 2023 06:40:17 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231212134844.1213381-1-lukasz.luba@arm.com> <20231212134844.1213381-5-lukasz.luba@arm.com> In-Reply-To: <20231212134844.1213381-5-lukasz.luba@arm.com> From: "Rafael J. Wysocki" Date: Wed, 20 Dec 2023 15:40:06 +0100 Message-ID: Subject: Re: [PATCH v2 4/8] thermal: gov_power_allocator: Simplify checks for valid power actor To: Lukasz Luba Cc: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org, rafael@kernel.org, linux-pm@vger.kernel.org, rui.zhang@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Dec 12, 2023 at 2:48=E2=80=AFPM Lukasz Luba w= rote: > > 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." > > 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 =3D=3D params->trip_max) && The inner parens are redundant. > + cdev_is_power_actor(instance->cdev)); > +} The part below LGTM.