From: Mario Limonciello <mario.limonciello@amd.com>
To: Arnd Bergmann <arnd@kernel.org>, Huang Rui <ray.huang@amd.com>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Perry Yuan <perry.yuan@amd.com>, Wyes Karny <wyes.karny@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Meng Li <li.meng@amd.com>,
Swapnil Sapkal <swapnil.sapkal@amd.com>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpufreq: amd-pstate: remove global header file
Date: Tue, 28 May 2024 12:49:28 -0500 [thread overview]
Message-ID: <0edd0485-274a-4b3f-8ecb-60708963db8a@amd.com> (raw)
In-Reply-To: <20240528121124.3588248-1-arnd@kernel.org>
On 5/28/2024 07:09, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When extra warnings are enabled, gcc points out a global variable
> definition in a header:
>
> In file included from drivers/cpufreq/amd-pstate-ut.c:29:
> include/linux/amd-pstate.h:123:27: error: 'amd_pstate_mode_string' defined but not used [-Werror=unused-const-variable=]
> 123 | static const char * const amd_pstate_mode_string[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~
>
> This header is only included from two files in the same directory,
> and one of them uses only a single definition from it, so clean it
> up by moving most of the contents into the driver that uses them,
> and making shared bits a local header file.
>
> Fixes: 36c5014e5460 ("cpufreq: amd-pstate: optimize driver working mode selection in amd_pstate_param()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks!
Acked-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> MAINTAINERS | 1 -
> drivers/cpufreq/amd-pstate-ut.c | 3 +-
> drivers/cpufreq/amd-pstate.c | 34 ++++++++++++++++++-
> .../linux => drivers/cpufreq}/amd-pstate.h | 33 ------------------
> 4 files changed, 35 insertions(+), 36 deletions(-)
> rename {include/linux => drivers/cpufreq}/amd-pstate.h (82%)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 070a39b2b098..35a75ab8ef05 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1107,7 +1107,6 @@ L: linux-pm@vger.kernel.org
> S: Supported
> F: Documentation/admin-guide/pm/amd-pstate.rst
> F: drivers/cpufreq/amd-pstate*
> -F: include/linux/amd-pstate.h
> F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
>
> AMD PTDMA DRIVER
> diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
> index f04ae67dda37..fc275d41d51e 100644
> --- a/drivers/cpufreq/amd-pstate-ut.c
> +++ b/drivers/cpufreq/amd-pstate-ut.c
> @@ -26,10 +26,11 @@
> #include <linux/module.h>
> #include <linux/moduleparam.h>
> #include <linux/fs.h>
> -#include <linux/amd-pstate.h>
>
> #include <acpi/cppc_acpi.h>
>
> +#include "amd-pstate.h"
> +
> /*
> * Abbreviations:
> * amd_pstate_ut: used as a shortform for AMD P-State unit test.
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 1b7e82a0ad2e..91993647e09e 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -36,7 +36,6 @@
> #include <linux/delay.h>
> #include <linux/uaccess.h>
> #include <linux/static_call.h>
> -#include <linux/amd-pstate.h>
> #include <linux/topology.h>
>
> #include <acpi/processor.h>
> @@ -46,6 +45,8 @@
> #include <asm/processor.h>
> #include <asm/cpufeature.h>
> #include <asm/cpu_device_id.h>
> +
> +#include "amd-pstate.h"
> #include "amd-pstate-trace.h"
>
> #define AMD_PSTATE_TRANSITION_LATENCY 20000
> @@ -53,6 +54,37 @@
> #define CPPC_HIGHEST_PERF_PERFORMANCE 196
> #define CPPC_HIGHEST_PERF_DEFAULT 166
>
> +#define AMD_CPPC_EPP_PERFORMANCE 0x00
> +#define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80
> +#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF
> +#define AMD_CPPC_EPP_POWERSAVE 0xFF
> +
> +/*
> + * enum amd_pstate_mode - driver working mode of amd pstate
> + */
> +enum amd_pstate_mode {
> + AMD_PSTATE_UNDEFINED = 0,
> + AMD_PSTATE_DISABLE,
> + AMD_PSTATE_PASSIVE,
> + AMD_PSTATE_ACTIVE,
> + AMD_PSTATE_GUIDED,
> + AMD_PSTATE_MAX,
> +};
> +
> +static const char * const amd_pstate_mode_string[] = {
> + [AMD_PSTATE_UNDEFINED] = "undefined",
> + [AMD_PSTATE_DISABLE] = "disable",
> + [AMD_PSTATE_PASSIVE] = "passive",
> + [AMD_PSTATE_ACTIVE] = "active",
> + [AMD_PSTATE_GUIDED] = "guided",
> + NULL,
> +};
> +
> +struct quirk_entry {
> + u32 nominal_freq;
> + u32 lowest_freq;
> +};
> +
> /*
> * TODO: We need more time to fine tune processors with shared memory solution
> * with community together.
> diff --git a/include/linux/amd-pstate.h b/drivers/cpufreq/amd-pstate.h
> similarity index 82%
> rename from include/linux/amd-pstate.h
> rename to drivers/cpufreq/amd-pstate.h
> index d58fc022ec46..e6a28e7f4dbf 100644
> --- a/include/linux/amd-pstate.h
> +++ b/drivers/cpufreq/amd-pstate.h
> @@ -1,7 +1,5 @@
> /* SPDX-License-Identifier: GPL-2.0-only */
> /*
> - * linux/include/linux/amd-pstate.h
> - *
> * Copyright (C) 2022 Advanced Micro Devices, Inc.
> *
> * Author: Meng Li <li.meng@amd.com>
> @@ -12,11 +10,6 @@
>
> #include <linux/pm_qos.h>
>
> -#define AMD_CPPC_EPP_PERFORMANCE 0x00
> -#define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80
> -#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF
> -#define AMD_CPPC_EPP_POWERSAVE 0xFF
> -
> /*********************************************************************
> * AMD P-state INTERFACE *
> *********************************************************************/
> @@ -108,30 +101,4 @@ struct amd_cpudata {
> bool suspended;
> };
>
> -/*
> - * enum amd_pstate_mode - driver working mode of amd pstate
> - */
> -enum amd_pstate_mode {
> - AMD_PSTATE_UNDEFINED = 0,
> - AMD_PSTATE_DISABLE,
> - AMD_PSTATE_PASSIVE,
> - AMD_PSTATE_ACTIVE,
> - AMD_PSTATE_GUIDED,
> - AMD_PSTATE_MAX,
> -};
> -
> -static const char * const amd_pstate_mode_string[] = {
> - [AMD_PSTATE_UNDEFINED] = "undefined",
> - [AMD_PSTATE_DISABLE] = "disable",
> - [AMD_PSTATE_PASSIVE] = "passive",
> - [AMD_PSTATE_ACTIVE] = "active",
> - [AMD_PSTATE_GUIDED] = "guided",
> - NULL,
> -};
> -
> -struct quirk_entry {
> - u32 nominal_freq;
> - u32 lowest_freq;
> -};
> -
> #endif /* _LINUX_AMD_PSTATE_H */
next prev parent reply other threads:[~2024-05-28 17:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 12:09 [PATCH] cpufreq: amd-pstate: remove global header file Arnd Bergmann
2024-05-28 17:49 ` Mario Limonciello [this message]
2024-05-28 20:00 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0edd0485-274a-4b3f-8ecb-60708963db8a@amd.com \
--to=mario.limonciello@amd.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=gautham.shenoy@amd.com \
--cc=li.meng@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=perry.yuan@amd.com \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=swapnil.sapkal@amd.com \
--cc=viresh.kumar@linaro.org \
--cc=wyes.karny@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox