Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp907056rdb; Wed, 6 Dec 2023 03:31:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHVkf5XsyxgmXsZbsgVD5V00y35madMQ8UGXQtSuhoRHPI6Qs7TmSh4IgFl4AGVU0b4Wd+ X-Received: by 2002:a05:6a20:8e28:b0:186:e53:b64b with SMTP id y40-20020a056a208e2800b001860e53b64bmr593267pzj.47.1701862274857; Wed, 06 Dec 2023 03:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701862274; cv=none; d=google.com; s=arc-20160816; b=TPCYsERmHZ7PlxgxQna3IrPwQyzT3b/3idQSj/vJrbTDL1lCAJle1ljNPYmJ8D1iYg gbV7GOcJSErcDU1Ou4ll8eG7Ath3tLXQMQPBCkQg9zL4byD9oKdpDXHWssShRKot57MK OjM9vp4Fe85nHd+r7Wk4G0ThveH54kC9pgQnC6mUKAQV8tc9ldxlOyhHKnx5Axf4jSrW w2M2UtjatMq2oABylKwuqcgKjfZyDxsxLNFdiBNqQ22ucbhGRFA4D1l4IWiGbsf1jqyi Fpr0FGvsg2BDXpMUvSclC+v3HvelTWn5C8CNSV0Ts8ToZ1wfOjLTSfqOiKTmNSIR1+1q BvsQ== 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=Iux+DtwZOJglWxJfXyqcj32nRNQfMaax6rpwwarruQ03WpO1t+J6+fcyYn4I9Uol2Q DBUnMYwwCigo4gINUa6WI+Vaw74ixlRhzlxZPlGLE1wIrku9EPoZ0rezmkSOFBSGpQRx nyE9K2mzOA/SiVhT7CSrX7fGsT5zjgl/G4YmPVWfpZqxQUaFEZsdk5T1gtFyxFIEfXMD x1yxVvMWJHDs93YkCOSw51hRJTkBGFCOHfgFv7/Xgm8s5Yifpf0jdjk2sYvS1sHOv3x4 JgiaO8QaTpuaJUdsVh6BQSuAUlWWn8/pq8dlkm3YnPcMCo0H57iGrnnf3YrUN6Or3dxB 8jeA== 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:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id g15-20020a17090a3c8f00b00286da82b44esi3018214pjc.182.2023.12.06.03.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 03:31:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 831BD802F45A; Wed, 6 Dec 2023 03:31:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377684AbjLFLaw (ORCPT + 99 others); Wed, 6 Dec 2023 06:30:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377692AbjLFLam (ORCPT ); Wed, 6 Dec 2023 06:30:42 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5E21ED4B; Wed, 6 Dec 2023 03:30:47 -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 38AEF153B; Wed, 6 Dec 2023 03:31:33 -0800 (PST) Received: from e129166.arm.com (unknown [10.57.1.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id ECCE13F5A1; Wed, 6 Dec 2023 03:30:45 -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 2/5] thermal: gov_power_allocator: Refactor check_power_actors() Date: Wed, 6 Dec 2023 11:31:35 +0000 Message-Id: <20231206113138.3576492-3-lukasz.luba@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231206113138.3576492-1-lukasz.luba@arm.com> References: <20231206113138.3576492-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 06 Dec 2023 03:31:05 -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