Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4765344ioo; Tue, 31 May 2022 11:03:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGLz6x943IFJ5E7suHokJL+t/6eqpbhux2+bTinn2lEugG8Pc+YFmorAfyZKliusuQ4KNW X-Received: by 2002:a63:8542:0:b0:3fc:8f74:9daf with SMTP id u63-20020a638542000000b003fc8f749dafmr937386pgd.397.1654020218390; Tue, 31 May 2022 11:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654020218; cv=none; d=google.com; s=arc-20160816; b=SXVKQdVwjepAVj0oogfMdzPgddoGrh+Y6IWbYTBxvbvTI7MWMiMJEAlxPUZOYYVDi7 /tmjTB6fz1xNl+mbEfMC+EpmVDYNPezZG/lGFBRef5y2r5eccrxCRBWQVvq5KmKXY4+w I9QDXGjUNKrRup29z8xZdQE5NL3S2OeW9aVQXle7tQ8vp/jpIC8Lt144kP4cx6pkLu36 t1Qo2Mxz59s/2lO5jR35jh6aFu6y6p7wDpKCU7Q8RaiGYZwZu85S4tEI2NHVlcGXMZab Nzj1SyUeWz6+L1gCgzFye9qabRGIpc98aj3zV5R3Er9e8nPs6YcjqmJySRKuD44ffbDI uK7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=OK6PzLYnRCp+t8ReEBWlxLLCTYEukvjsyudoOiWnyL8=; b=BK+2O4BD9P1dUadMTmgZvyRwcEBLF519IlC+QENnm6hQZ8IULsFZddIwW3bvQbAVr8 1vFZQZzHey78n0u5OLAE7ZM6gbaoOJZYukxIxvurQLl4vZbUDeDHX0wVuIpR+TqihSGU 6t2AIbu8JON8Zc7lPU4lNWmmujUXfO3WYeSAKxz3HuOGBsTZ913Ms3XElmqWt2RIoIaM 3hmNZ/eCqVD+bsaLKHjOtT/tPqX3NcaqYEHMhYr+8j9xLm7ZlfoCeEyXxEJjh+szzqPM q36qpDi5h7v4SsMtvK/IbKMQqh9obFAoro/qGIhZojcsCAI3eiVBQhrqFzZFShR74+6w DCNw== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170903208b00b00163ed1aff09si5637583plc.337.2022.05.31.11.03.19; Tue, 31 May 2022 11:03:38 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235855AbiE3L4B (ORCPT + 99 others); Mon, 30 May 2022 07:56:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235985AbiE3Lz6 (ORCPT ); Mon, 30 May 2022 07:55:58 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4597B6FD38; Mon, 30 May 2022 04:55:57 -0700 (PDT) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LBYkM0bBlzjX8N; Mon, 30 May 2022 19:55:07 +0800 (CST) Received: from [10.67.77.175] (10.67.77.175) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 30 May 2022 19:55:55 +0800 Subject: Re: [PATCH -next v2 1/1] cpufreq: CPPC: Fix unused-function warning To: Pierre Gondois , CC: , , "Rafael J. Wysocki" , Viresh Kumar , References: <20220530100424.103301-1-pierre.gondois@arm.com> <20220530100424.103301-2-pierre.gondois@arm.com> From: Shaokun Zhang Message-ID: Date: Mon, 30 May 2022 19:55:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20220530100424.103301-2-pierre.gondois@arm.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.77.175] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 Hi, It works for me on compile when CONFIG_ENERGY_MODEL=n, please feel free to add: Tested-by: Shaokun Zhang Thanks, Shaokun On 2022/5/30 18:04, Pierre Gondois wrote: > 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; >