From patchwork Mon Feb 7 07:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 12737005 X-Patchwork-Delegate: daniel.lezcano@linaro.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52AB7C433EF for ; Mon, 7 Feb 2022 07:45:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234231AbiBGHoc (ORCPT ); Mon, 7 Feb 2022 02:44:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244572AbiBGHie (ORCPT ); Mon, 7 Feb 2022 02:38:34 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C40F5C043184; Sun, 6 Feb 2022 23:38:33 -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 184751396; Sun, 6 Feb 2022 23:30:52 -0800 (PST) Received: from e123648.arm.com (unknown [10.57.15.201]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F2C1A3F73B; Sun, 6 Feb 2022 23:30:49 -0800 (PST) From: Lukasz Luba To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: amit.kachhap@gmail.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com, dietmar.eggemann@arm.com, lukasz.luba@arm.com, Pierre.Gondois@arm.com Subject: [PATCH 2/2] powercap: DTPM: Check Energy Model type for power values scale Date: Mon, 7 Feb 2022 07:30:36 +0000 Message-Id: <20220207073036.14901-3-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220207073036.14901-1-lukasz.luba@arm.com> References: <20220207073036.14901-1-lukasz.luba@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The Energy Model power values might be in an abstract scale. In such case it's safe to bail out during the registration, since the PowerCap framework supports only micro-Watts. Signed-off-by: Lukasz Luba --- drivers/powercap/dtpm_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c index b740866b228d..e6bcde081de4 100644 --- a/drivers/powercap/dtpm_cpu.c +++ b/drivers/powercap/dtpm_cpu.c @@ -188,7 +188,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu) return 0; pd = em_cpu_get(cpu); - if (!pd) + if (!pd || !(pd->flags & EM_PERF_DOMAIN_MILLIWATTS)) return -EINVAL; dtpm_cpu = per_cpu(dtpm_per_cpu, cpu);