[PATCH] cpufreq: amd-pstate: set varaiable mode_state_machine storage-class-specifier to static

Tom Rix posted 1 patch 3 years ago
drivers/cpufreq/amd-pstate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] cpufreq: amd-pstate: set varaiable mode_state_machine storage-class-specifier to static
Posted by Tom Rix 3 years ago
smatch reports
drivers/cpufreq/amd-pstate.c:907:25: warning: symbol
  'mode_state_machine' was not declared. Should it be static?

This variable is only used in one file so it should be static.

Signed-off-by: Tom Rix <trix@redhat.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 6f4b8040d46c..5a3d4aa0f45a 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -904,7 +904,7 @@ static int amd_pstate_change_driver_mode(int mode)
 	return 0;
 }
 
-cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = {
+static cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = {
 	[AMD_PSTATE_DISABLE]         = {
 		[AMD_PSTATE_DISABLE]     = NULL,
 		[AMD_PSTATE_PASSIVE]     = amd_pstate_register_driver,
-- 
2.27.0
Re: [PATCH] cpufreq: amd-pstate: set varaiable mode_state_machine storage-class-specifier to static
Posted by Rafael J. Wysocki 3 years ago
On Tue, Apr 4, 2023 at 2:33 AM Tom Rix <trix@redhat.com> wrote:
>
> smatch reports
> drivers/cpufreq/amd-pstate.c:907:25: warning: symbol
>   'mode_state_machine' was not declared. Should it be static?
>
> This variable is only used in one file so it should be static.
>
> Signed-off-by: Tom Rix <trix@redhat.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 6f4b8040d46c..5a3d4aa0f45a 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -904,7 +904,7 @@ static int amd_pstate_change_driver_mode(int mode)
>         return 0;
>  }
>
> -cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = {
> +static cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = {
>         [AMD_PSTATE_DISABLE]         = {
>                 [AMD_PSTATE_DISABLE]     = NULL,
>                 [AMD_PSTATE_PASSIVE]     = amd_pstate_register_driver,
> --

Applied as 6.4 material (under edited subject), thanks!
Re: [PATCH] cpufreq: amd-pstate: set varaiable mode_state_machine storage-class-specifier to static
Posted by Dhruva Gole 3 years ago

On 04/04/23 06:03, Tom Rix wrote:
> smatch reports
> drivers/cpufreq/amd-pstate.c:907:25: warning: symbol
>    'mode_state_machine' was not declared. Should it be static?
> 
> This variable is only used in one file so it should be static.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---

You might want to use the Fixes: commit ("")
tag? It will help people to pick the patch while
back-porting fixes to older kernels.'

For example:
https://lore.kernel.org/all/20230403072443.83810-2-d-gole@ti.com/

Fixes: 0651a730924b ("gpio: davinci: Add support for system 
suspend/resume PM")

Otherwise,

Reviewed-by: Dhruva Gole <d-gole@ti.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 6f4b8040d46c..5a3d4aa0f45a 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -904,7 +904,7 @@ static int amd_pstate_change_driver_mode(int mode)
>   	return 0;
>   }
>   
> -cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = {
> +static cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = {
>   	[AMD_PSTATE_DISABLE]         = {
>   		[AMD_PSTATE_DISABLE]     = NULL,
>   		[AMD_PSTATE_PASSIVE]     = amd_pstate_register_driver,

-- 
Thanks and Regards,
Dhruva Gole
Re: [PATCH] cpufreq: amd-pstate: set varaiable mode_state_machine storage-class-specifier to static
Posted by Wyes Karny 3 years ago
On 03 Apr 20:33, Tom Rix wrote:
> smatch reports
> drivers/cpufreq/amd-pstate.c:907:25: warning: symbol
>   'mode_state_machine' was not declared. Should it be static?
> 
> This variable is only used in one file so it should be static.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Reviewed-by: Wyes Karny <wyes.karny@amd.com>
Tested-by: Wyes Karny <wyes.karny@amd.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 6f4b8040d46c..5a3d4aa0f45a 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -904,7 +904,7 @@ static int amd_pstate_change_driver_mode(int mode)
>  	return 0;
>  }
>  
> -cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = {
> +static cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = {
>  	[AMD_PSTATE_DISABLE]         = {
>  		[AMD_PSTATE_DISABLE]     = NULL,
>  		[AMD_PSTATE_PASSIVE]     = amd_pstate_register_driver,
> -- 
> 2.27.0
>