Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4647285rdb; Tue, 12 Dec 2023 05:49:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9LTRQXPWNZXSWB/lYrp8VZdh0MdS3hcsJ9plunlcNC+/j/ToZ7I/rmPrCu2C0tpiGVR27 X-Received: by 2002:a05:6a20:244f:b0:18f:f040:86df with SMTP id t15-20020a056a20244f00b0018ff04086dfmr6787252pzc.82.1702388940062; Tue, 12 Dec 2023 05:49:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702388940; cv=none; d=google.com; s=arc-20160816; b=KG0s9K8ZrVpcht6XzlIGZ3CWv2d8DQAWSf8BXqYWJ9uxsF9u81PVxrOJV3T3zqFhcG JGn3WFPQV369qkwh6kEK/c2fDrjBiwN9R0MGk4tF5FEK10OZQB03KIG5UIdXTI0halE6 6hxSr3ETygGCdxeOYIlpOk+HsrWPs82yVT8EaOJx/ckHhAeVlFEpRAtHSnRAYetCE6TN CmcOTxWP6Oup8OWc+EuBBnpxSmBhLOylhOR6SU0yNWsH8WnH8rKoc41QLGTG8o2DQqEx p1koaouo/DH3VtNh1J2RB+hrfcw0dkMdMBxZGbtGT6pTfYT57pFTxxtnYdhGMeFuoOd0 LKjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=R0DMEV4+cUrAwHbGcteLj/PvnMGmiVqdVIaAxECQnII=; fh=8IgpUQ2T6XGOjA/qDosxdUSIIBz0a6nQ23NA8pgv1Tg=; b=ttRBAnBvyj6PKXhZUMb81nZ8aCSocwLkz2sH16UI3bO3ygDp9c05Xj91lEM2u3jccG bm4AkDLKTdt5Txp3vC/NECRwlMxxJ03SKT78M5PN2DpuGWx3D0LWmoEYzRhVAbcDr6uy Nv7kGUk3czyGUaSAU6FpxhsjbpMOxQPqLNpSt76D1YwlYEwflI4RV75Pn/jd2qS/8It8 WyJfpF3zKjXXYGBSk0QjP8TbxaIFEGHIVC6+ylBF2JYnJNiInulfK2banZAg3Q3eLEju veVODcugAmpXtl1y2uF1rRqAWM7MuQZ0SqxtQ7oPGp4h2QAwfLjBXRa3MEHlf35yJtyT u2gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id y40-20020a056a001ca800b006cef5e5121dsi5377605pfw.198.2023.12.12.05.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 05:49:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8E1DF80A1485; Tue, 12 Dec 2023 05:48:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376369AbjLLNr7 (ORCPT + 99 others); Tue, 12 Dec 2023 08:47:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376334AbjLLNrx (ORCPT ); Tue, 12 Dec 2023 08:47:53 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1A4E1A1; Tue, 12 Dec 2023 05:48:00 -0800 (PST) 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 2ABDD1516; Tue, 12 Dec 2023 05:48:46 -0800 (PST) Received: from e129166.arm.com (unknown [10.57.82.227]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9670F3F738; Tue, 12 Dec 2023 05:47:58 -0800 (PST) From: Lukasz Luba To: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com Subject: [PATCH v2 2/8] thermal: gov_power_allocator: Refactor check_power_actors() Date: Tue, 12 Dec 2023 13:48:38 +0000 Message-Id: <20231212134844.1213381-3-lukasz.luba@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231212134844.1213381-1-lukasz.luba@arm.com> References: <20231212134844.1213381-1-lukasz.luba@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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 fry.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 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 05:48:57 -0800 (PST) Refactor check_power_actors() to make it possible for re-use in the upcoming new callback. No intentional functional impact. Signed-off-by: Lukasz Luba --- drivers/thermal/gov_power_allocator.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index 785fff14223d..38e1e89ba10c 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -581,8 +581,9 @@ static void allow_maximum_power(struct thermal_zone_device *tz, bool update) * power actor API. The warning should help to investigate the issue, which * could be e.g. lack of Energy Model for a given device. * - * Return: 0 on success, -EINVAL if any cooling device does not implement - * the power actor API. + * Return number of cooling devices or -EINVAL if any cooling device does not + * implement the power actor API. Return value 0 is also valid since cooling + * devices might be attached later. */ static int check_power_actors(struct thermal_zone_device *tz, struct power_allocator_params *params) @@ -597,8 +598,9 @@ static int check_power_actors(struct thermal_zone_device *tz, if (!cdev_is_power_actor(instance->cdev)) { dev_warn(&tz->device, "power_allocator: %s is not a power actor\n", instance->cdev->type); - ret = -EINVAL; + return -EINVAL; } + ret++; } return ret; @@ -631,7 +633,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz) } ret = check_power_actors(tz, params); - if (ret) { + if (ret < 0) { dev_warn(&tz->device, "power_allocator: binding failed\n"); kfree(params); return ret; -- 2.25.1