[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aO9fqrHpfWN/mdGK@BLRRASHENOY1.amd.com>
Date: Wed, 15 Oct 2025 14:17:38 +0530
From: "Gautham R. Shenoy" <gautham.shenoy@....com>
To: "Mario Limonciello (AMD)" <superm1@...nel.org>
Cc: Perry Yuan <perry.yuan@....com>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <linux-kernel@...r.kernel.org>,
"open list:CPU FREQUENCY SCALING FRAMEWORK" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v2 2/6] cpufreq/amd-pstate: Drop NULL value from
amd_pstate_mode_string
On Thu, Oct 09, 2025 at 11:17:52AM -0500, Mario Limonciello (AMD) wrote:
> None of the users actually look for the NULL value. To avoid risk
> of regression introducing a new value but forgetting to add a string
> add a static assert to test AMD_PSTATE_MAX matches the array size.
>
> Signed-off-by: Mario Limonciello (AMD) <superm1@...nel.org>
Thanks for getting rid of the NULL entry.
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@....com>
> ---
> drivers/cpufreq/amd-pstate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 0bc5013448873..a5b9e5baf4234 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -65,8 +65,8 @@ static const char * const amd_pstate_mode_string[] = {
> [AMD_PSTATE_PASSIVE] = "passive",
> [AMD_PSTATE_ACTIVE] = "active",
> [AMD_PSTATE_GUIDED] = "guided",
> - NULL,
> };
> +static_assert(ARRAY_SIZE(amd_pstate_mode_string) == AMD_PSTATE_MAX);
>
> const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)
> {
> --
> 2.43.0
>
Powered by blists - more mailing lists