Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp841933pxb; Tue, 8 Feb 2022 03:51:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzU/tKaBOv+zs2hjGqPlQtTl5L4Tz6cHVMFS89nyLZn9QFka7lgFVWnUeJvptJxHtc84yF7 X-Received: by 2002:a17:90b:1e05:: with SMTP id pg5mr949469pjb.56.1644321078758; Tue, 08 Feb 2022 03:51:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644321078; cv=none; d=google.com; s=arc-20160816; b=zZ/Ob13xLWdyNRqBZJA0zKpOvXWeM9kl46pdDsNPFa2JxWqdx+Zqlf/jno3BxfyIUj RVu6qwVxoaPMy/yg0f/kT1yX83EfktwIyiMk7t9ENFw/wxpMy7Z5QKD0P5KE9iMY3NQ1 UF1QeRyj3ainHnxQH2gMq2iRTGWaEKr7z3Y0CRWsvSm2Syvt8ZqoMZyUuLnlvlFFxJpe pgPxruSMNkMF2uRMWTr8k9pHMwSIXkr1p4XRgFl8V/hDt8czK+3O8B+eroNPA6olrUIu OZvRW2Lz98RWdosoryOTs0yuHE0w3CeLfq8GVxz3nW9F5UiEzV4razpPbUZ43EQ5TpcV kw9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=XyykyBcsGGPpcKcinPYRxJEmlG2Y42Bdm5UUsPR2D84=; b=P6JHppiP5Bzdk5fribvqx4QSjhx1FK/haYy5gQ/vG3JIGJkeBvuJB9bQuCupqR7NLv 7KbThkRSpPf3zLVCyEw7vFPgDo+jZ7JU7VYRN0YZ7un9WbWV1BhMk3uKuYP11Vh7O52T gZM4FCPmudpNBNKieMYr1SYM93/ackC19hbuTTkMTbUOzw2MRglMRgduCjj3k4UettiO 7badaoUb2bX5mM/cKWbHkSiAMY/QO9O4koZizh1W472YBN/93+EdIV1wc2jDHIt4qPw/ dlmvk42jqSdGXIRJgOFTEOyi6C4c1oM1n5vQ+bsUalPa7yFF+s7y/q/Pwlj5g6LZdHpL Zt+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m12si13387408pfh.279.2022.02.08.03.51.06; Tue, 08 Feb 2022 03:51:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235463AbiBGHnj (ORCPT + 99 others); Mon, 7 Feb 2022 02:43:39 -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> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); -- 2.17.1