[v3,1/5] cpupower: Recognise amd-pstate active mode driver

Message ID 20230619190503.4061-2-wyes.karny@amd.com
State New
Headers
Series cpupower: Add various feature control support for amd_pstate |

Commit Message

Wyes Karny June 19, 2023, 7:04 p.m. UTC
  amd-pstate active mode driver name is "amd-pstate-epp". Use common
prefix for string matching condition to recognise amd-pstate active mode
driver.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Wyes Karny <wyes.karny@amd.com>
---
 tools/power/cpupower/utils/helpers/misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Yuan, Perry June 20, 2023, 3:10 a.m. UTC | #1
[AMD Official Use Only - General]

> -----Original Message-----
> From: Karny, Wyes <Wyes.Karny@amd.com>
> Sent: Tuesday, June 20, 2023 3:05 AM
> To: trenn@suse.com; shuah@kernel.org
> Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; rafael@kernel.org;
> Shenoy, Gautham Ranjal <gautham.shenoy@amd.com>; Limonciello, Mario
> <Mario.Limonciello@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Yuan,
> Perry <Perry.Yuan@amd.com>; Karny, Wyes <Wyes.Karny@amd.com>
> Subject: [PATCH v3 1/5] cpupower: Recognise amd-pstate active mode driver
>
> amd-pstate active mode driver name is "amd-pstate-epp". Use common prefix
> for string matching condition to recognise amd-pstate active mode driver.
>
> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
> Signed-off-by: Wyes Karny <wyes.karny@amd.com>
> ---
>  tools/power/cpupower/utils/helpers/misc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/power/cpupower/utils/helpers/misc.c
> b/tools/power/cpupower/utils/helpers/misc.c
> index 9547b29254a7..0c56fc77f93b 100644
> --- a/tools/power/cpupower/utils/helpers/misc.c
> +++ b/tools/power/cpupower/utils/helpers/misc.c
> @@ -95,7 +95,7 @@ bool cpupower_amd_pstate_enabled(void)
>       if (!driver)
>               return ret;
>
> -     if (!strcmp(driver, "amd-pstate"))
> +     if (!strncmp(driver, "amd", 3))
>               ret = true;
>
>       cpufreq_put_driver(driver);
> --
> 2.34.1

Tested-by: Perry Yuan <Perry.Yuan@amd.com>
  
Huang Rui June 20, 2023, 12:49 p.m. UTC | #2
On Tue, Jun 20, 2023 at 03:04:59AM +0800, Karny, Wyes wrote:
> amd-pstate active mode driver name is "amd-pstate-epp". Use common
> prefix for string matching condition to recognise amd-pstate active mode
> driver.
> 
> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
> Signed-off-by: Wyes Karny <wyes.karny@amd.com>

Acked-by: Huang Rui <ray.huang@amd.com>

> ---
>  tools/power/cpupower/utils/helpers/misc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c
> index 9547b29254a7..0c56fc77f93b 100644
> --- a/tools/power/cpupower/utils/helpers/misc.c
> +++ b/tools/power/cpupower/utils/helpers/misc.c
> @@ -95,7 +95,7 @@ bool cpupower_amd_pstate_enabled(void)
>  	if (!driver)
>  		return ret;
>  
> -	if (!strcmp(driver, "amd-pstate"))
> +	if (!strncmp(driver, "amd", 3))
>  		ret = true;
>  
>  	cpufreq_put_driver(driver);
> -- 
> 2.34.1
>
  

Patch

diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c
index 9547b29254a7..0c56fc77f93b 100644
--- a/tools/power/cpupower/utils/helpers/misc.c
+++ b/tools/power/cpupower/utils/helpers/misc.c
@@ -95,7 +95,7 @@  bool cpupower_amd_pstate_enabled(void)
 	if (!driver)
 		return ret;
 
-	if (!strcmp(driver, "amd-pstate"))
+	if (!strncmp(driver, "amd", 3))
 		ret = true;
 
 	cpufreq_put_driver(driver);