Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4455503ioo; Tue, 31 May 2022 05:03:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRfcArlEi9E2nD0O55Wobg4vp+BV0y3W7AZx+hMKawMO+bkNwma20lugFitI/5Zoh2DXAc X-Received: by 2002:aa7:c44b:0:b0:42d:d107:7e7a with SMTP id n11-20020aa7c44b000000b0042dd1077e7amr11144470edr.261.1653998605527; Tue, 31 May 2022 05:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653998605; cv=none; d=google.com; s=arc-20160816; b=059JIXOMuLQmCW6OHZme5EtZJdyef8Uk7/LmHtxbfNBAPQDLw+UvYIx7sBTPon67C6 q2lwdVd3hXnqr++aDex71CAXDJBgf883DbHjDlA5mwdAKLzzR49QrFQ06CAi6P87U05f F5W5YjN24fsq9R3v9DWa/T5rBzdcgha7fTHCrNWSfjRn6sbjuhWa6k27J3Nk7fDY1ibf /XIs28F7VQ7EdQHsHH1b3x/p5swbLzlvjIfdk1RRNUCebegRAO6j4IBKRqqDDDbEINhs gsYhQSttufH4Gd0ldfg2YJpqfukZm5YPODy2k1FSwai10CYUpzg+UPZ28AH+cRvWdkP6 LM9Q== 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=q0wcm2g9ebBVEPi7gs/suyeZ0Ntu2P8Fl5qRs1Q1Sfk=; b=XCVKvU9gByRxQEmVedDSPL8/QXPGjvCHv7PPpPT9z4B/j3xuliHSGKuYoIUV3nedlc NDiOmFnE5kTrLApzFn4Bg4w7JByS02nfW9lk4+lXZZbkqJVBfOR+Ngc4uuBly56EQile rCFry7kYANp3lU/3AuqGcOjl76WSkbnZsCzeuxCYhWEvq954WOgcl6RJMfqHFy7F1hE/ fk9V9XbiMwugWYj55HLZZNjmc7YJPoJ+sYB5BtBS9xnTCo6Ldv5KaUoYlktOQZhGCSSS Cdq8ROoRkahD+RiTWyObF2OmNKhSvLUWx1VJ1Ak+SMe+aLNT8G67oCLYiIER4wlGtUTy wRnA== 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 dp17-20020a170906c15100b006ff46987deasi13074999ejc.311.2022.05.31.05.02.59; Tue, 31 May 2022 05:03:25 -0700 (PDT) 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 S235063AbiE3KEo (ORCPT + 99 others); Mon, 30 May 2022 06:04:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235031AbiE3KEl (ORCPT ); Mon, 30 May 2022 06:04:41 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0D4DECE18; Mon, 30 May 2022 03:04:41 -0700 (PDT) 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 CAE71153B; Mon, 30 May 2022 03:04:40 -0700 (PDT) Received: from pierre123.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D252D3F73D; Mon, 30 May 2022 03:04:38 -0700 (PDT) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: zhangshaokun@hisilicon.com, Ionela.Voinescu@arm.com, Dietmar.Eggemann@arm.com, Pierre Gondois , "Rafael J. Wysocki" , Viresh Kumar , Pierre Gondois , linux-pm@vger.kernel.org Subject: [PATCH -next v2 1/1] cpufreq: CPPC: Fix unused-function warning Date: Mon, 30 May 2022 12:04:24 +0200 Message-Id: <20220530100424.103301-2-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220530100424.103301-1-pierre.gondois@arm.com> References: <20220530100424.103301-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Building the cppc_cpufreq driver with for arm64 with CONFIG_ENERGY_MODEL=n triggers the following warnings: drivers/cpufreq/cppc_cpufreq.c:550:12: error: ‘cppc_get_cpu_cost’ defined but not used [-Werror=unused-function] 550 | static int cppc_get_cpu_cost(struct device *cpu_dev, unsigned long KHz, | ^~~~~~~~~~~~~~~~~ drivers/cpufreq/cppc_cpufreq.c:481:12: error: ‘cppc_get_cpu_power’ defined but not used [-Werror=unused-function] 481 | static int cppc_get_cpu_power(struct device *cpu_dev, | ^~~~~~~~~~~~~~~~~~ Move the Energy Model related functions into specific guards. This allows to fix the warning and prevent doing extra work when the Energy Model is not present. Fixes: 740fcdc2c20e ("cpufreq: CPPC: Register EM based on efficiency class information") Reported-by: Shaokun Zhang Signed-off-by: Pierre Gondois --- drivers/cpufreq/cppc_cpufreq.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index f0a8bb2c59e5..24eaf0ec344d 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -441,6 +441,14 @@ static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu) } return cppc_get_transition_latency(cpu) / NSEC_PER_USEC; } +#else +static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu) +{ + return cppc_get_transition_latency(cpu) / NSEC_PER_USEC; +} +#endif + +#if defined(CONFIG_ARM64) && defined(CONFIG_ENERGY_MODEL) static DEFINE_PER_CPU(unsigned int, efficiency_class); static void cppc_cpufreq_register_em(struct cpufreq_policy *policy); @@ -621,21 +629,12 @@ static void cppc_cpufreq_register_em(struct cpufreq_policy *policy) } #else - -static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu) -{ - return cppc_get_transition_latency(cpu) / NSEC_PER_USEC; -} static int populate_efficiency_class(void) { return 0; } -static void cppc_cpufreq_register_em(struct cpufreq_policy *policy) -{ -} #endif - static struct cppc_cpudata *cppc_cpufreq_get_cpu_data(unsigned int cpu) { struct cppc_cpudata *cpu_data; -- 2.25.1