From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 704EFC433E2 for ; Tue, 14 Jul 2020 16:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5147222464 for ; Tue, 14 Jul 2020 16:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727898AbgGNQU5 (ORCPT ); Tue, 14 Jul 2020 12:20:57 -0400 Received: from foss.arm.com ([217.140.110.172]:46150 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbgGNQU5 (ORCPT ); Tue, 14 Jul 2020 12:20:57 -0400 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 D781730E; Tue, 14 Jul 2020 09:20:56 -0700 (PDT) Received: from [10.57.32.45] (unknown [10.57.32.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3B9C53F7BB; Tue, 14 Jul 2020 09:20:55 -0700 (PDT) Subject: Re: [PATCH 08/13] cpufreq: acpi-cpufreq: Take 'dummy' principle one stage further To: "Rafael J. Wysocki" , Lee Jones Cc: Denis Sadykov , Andy Grover , Linux PM , Viresh Kumar , "Rafael J. Wysocki" , Linux Kernel Mailing List , Paul Diefenbaugh , Linux ARM , Dominik Brodowski References: <20200714145049.2496163-1-lee.jones@linaro.org> <20200714145049.2496163-9-lee.jones@linaro.org> From: Robin Murphy Message-ID: <8b2f7674-9e33-e09c-cf99-84c59edb9779@arm.com> Date: Tue, 14 Jul 2020 17:20:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 2020-07-14 17:03, Rafael J. Wysocki wrote: > On Tue, Jul 14, 2020 at 4:51 PM Lee Jones wrote: >> >> If we fail to use a variable, even a 'dummy' one, then the compiler >> complains that it is set but not used. We know this is fine, so we >> set it to its own value here. > > Which is kind of ugly in my personal view. I hope that the compiler > will actually optimize the extra code away ... > >> Fixes the following W=1 kernel build warning(s): > > Well, "Makes the following ... warning(s) go away:" rather ... Isn't that what we have __maybe_unused and __always_unused for? Robin. >> drivers/cpufreq/acpi-cpufreq.c: In function ‘cpu_freq_read_intel’: >> drivers/cpufreq/acpi-cpufreq.c:247:11: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable] >> drivers/cpufreq/acpi-cpufreq.c: In function ‘cpu_freq_read_amd’: >> drivers/cpufreq/acpi-cpufreq.c:265:11: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable] >> >> Cc: Andy Grover >> Cc: Paul Diefenbaugh >> Cc: Dominik Brodowski >> Cc: Denis Sadykov >> Signed-off-by: Lee Jones >> --- >> drivers/cpufreq/acpi-cpufreq.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c >> index 429e5a36c08a9..d38a693b48e03 100644 >> --- a/drivers/cpufreq/acpi-cpufreq.c >> +++ b/drivers/cpufreq/acpi-cpufreq.c >> @@ -247,6 +247,7 @@ static u32 cpu_freq_read_intel(struct acpi_pct_register *not_used) >> u32 val, dummy; >> >> rdmsr(MSR_IA32_PERF_CTL, val, dummy); >> + dummy &= dummy; /* Silence set but not used warning */ >> return val; >> } >> >> @@ -264,6 +265,7 @@ static u32 cpu_freq_read_amd(struct acpi_pct_register *not_used) >> u32 val, dummy; >> >> rdmsr(MSR_AMD_PERF_CTL, val, dummy); >> + dummy &= dummy; /* Silence set but not used warning */ >> return val; >> } >> >> -- >> 2.25.1 >> > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >