[v8,12/13] cpufreq: amd-pstate: convert sprintf with sysfs_emit()

Message ID 20221219064042.661122-13-perry.yuan@amd.com
State New
Headers
Series Implement AMD Pstate EPP Driver |

Commit Message

Yuan, Perry Dec. 19, 2022, 6:40 a.m. UTC
  replace the sprintf with a more generic sysfs_emit function

No potential function impact

Signed-off-by: Perry Yuan <perry.yuan@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Mario Limonciello Dec. 19, 2022, 11:31 p.m. UTC | #1
On 12/19/2022 00:40, Perry Yuan wrote:
> replace the sprintf with a more generic sysfs_emit function
> 
> No potential function impact

Anything is possible!  "No intended functional impact." I believe is 
what you meant =)

> 
> Signed-off-by: Perry Yuan <perry.yuan@amd.com>

With commit message fixed:

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

> ---
>   drivers/cpufreq/amd-pstate.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index e8996e937e63..d8b182614c18 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -709,7 +709,7 @@ static ssize_t show_amd_pstate_max_freq(struct cpufreq_policy *policy,
>   	if (max_freq < 0)
>   		return max_freq;
>   
> -	return sprintf(&buf[0], "%u\n", max_freq);
> +	return sysfs_emit(buf, "%u\n", max_freq);
>   }
>   
>   static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *policy,
> @@ -722,7 +722,7 @@ static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *poli
>   	if (freq < 0)
>   		return freq;
>   
> -	return sprintf(&buf[0], "%u\n", freq);
> +	return sysfs_emit(buf, "%u\n", freq);
>   }
>   
>   /*
> @@ -737,7 +737,7 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,
>   
>   	perf = READ_ONCE(cpudata->highest_perf);
>   
> -	return sprintf(&buf[0], "%u\n", perf);
> +	return sysfs_emit(buf, "%u\n", perf);
>   }
>   
>   static ssize_t show_energy_performance_available_preferences(
  
Huang Rui Dec. 23, 2022, 7:45 a.m. UTC | #2
On Mon, Dec 19, 2022 at 02:40:41PM +0800, Yuan, Perry wrote:
> replace the sprintf with a more generic sysfs_emit function
> 
> No potential function impact
> 
> Signed-off-by: Perry Yuan <perry.yuan@amd.com>

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

> ---
>  drivers/cpufreq/amd-pstate.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index e8996e937e63..d8b182614c18 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -709,7 +709,7 @@ static ssize_t show_amd_pstate_max_freq(struct cpufreq_policy *policy,
>  	if (max_freq < 0)
>  		return max_freq;
>  
> -	return sprintf(&buf[0], "%u\n", max_freq);
> +	return sysfs_emit(buf, "%u\n", max_freq);
>  }
>  
>  static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *policy,
> @@ -722,7 +722,7 @@ static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *poli
>  	if (freq < 0)
>  		return freq;
>  
> -	return sprintf(&buf[0], "%u\n", freq);
> +	return sysfs_emit(buf, "%u\n", freq);
>  }
>  
>  /*
> @@ -737,7 +737,7 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,
>  
>  	perf = READ_ONCE(cpudata->highest_perf);
>  
> -	return sprintf(&buf[0], "%u\n", perf);
> +	return sysfs_emit(buf, "%u\n", perf);
>  }
>  
>  static ssize_t show_energy_performance_available_preferences(
> -- 
> 2.34.1
>
  
Yuan, Perry Dec. 25, 2022, 4:42 p.m. UTC | #3
[AMD Official Use Only - General]

Hi Mario. 

> -----Original Message-----
> From: Limonciello, Mario <Mario.Limonciello@amd.com>
> Sent: Tuesday, December 20, 2022 7:31 AM
> To: Yuan, Perry <Perry.Yuan@amd.com>; rafael.j.wysocki@intel.com; Huang,
> Ray <Ray.Huang@amd.com>; viresh.kumar@linaro.org
> Cc: Sharma, Deepak <Deepak.Sharma@amd.com>; Fontenot, Nathan
> <Nathan.Fontenot@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Huang, Shimmer
> <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; Meng,
> Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes <Wyes.Karny@amd.com>;
> linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v8 12/13] cpufreq: amd-pstate: convert sprintf with
> sysfs_emit()
> 
> On 12/19/2022 00:40, Perry Yuan wrote:
> > replace the sprintf with a more generic sysfs_emit function
> >
> > No potential function impact
> 
> Anything is possible!  "No intended functional impact." I believe is what you
> meant =)
> 
> >
> > Signed-off-by: Perry Yuan <perry.yuan@amd.com>
> 
> With commit message fixed:
> 
> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

Thanks for your review , all the R-B flags have been picked up in v9 .
And other feedbacks from you have been changed in v9 as well.
 

Perry.

> 
> > ---
> >   drivers/cpufreq/amd-pstate.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/cpufreq/amd-pstate.c
> > b/drivers/cpufreq/amd-pstate.c index e8996e937e63..d8b182614c18
> 100644
> > --- a/drivers/cpufreq/amd-pstate.c
> > +++ b/drivers/cpufreq/amd-pstate.c
> > @@ -709,7 +709,7 @@ static ssize_t show_amd_pstate_max_freq(struct
> cpufreq_policy *policy,
> >   	if (max_freq < 0)
> >   		return max_freq;
> >
> > -	return sprintf(&buf[0], "%u\n", max_freq);
> > +	return sysfs_emit(buf, "%u\n", max_freq);
> >   }
> >
> >   static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct
> > cpufreq_policy *policy, @@ -722,7 +722,7 @@ static ssize_t
> show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *poli
> >   	if (freq < 0)
> >   		return freq;
> >
> > -	return sprintf(&buf[0], "%u\n", freq);
> > +	return sysfs_emit(buf, "%u\n", freq);
> >   }
> >
> >   /*
> > @@ -737,7 +737,7 @@ static ssize_t
> show_amd_pstate_highest_perf(struct
> > cpufreq_policy *policy,
> >
> >   	perf = READ_ONCE(cpudata->highest_perf);
> >
> > -	return sprintf(&buf[0], "%u\n", perf);
> > +	return sysfs_emit(buf, "%u\n", perf);
> >   }
> >
> >   static ssize_t show_energy_performance_available_preferences(
  

Patch

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index e8996e937e63..d8b182614c18 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -709,7 +709,7 @@  static ssize_t show_amd_pstate_max_freq(struct cpufreq_policy *policy,
 	if (max_freq < 0)
 		return max_freq;
 
-	return sprintf(&buf[0], "%u\n", max_freq);
+	return sysfs_emit(buf, "%u\n", max_freq);
 }
 
 static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *policy,
@@ -722,7 +722,7 @@  static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *poli
 	if (freq < 0)
 		return freq;
 
-	return sprintf(&buf[0], "%u\n", freq);
+	return sysfs_emit(buf, "%u\n", freq);
 }
 
 /*
@@ -737,7 +737,7 @@  static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,
 
 	perf = READ_ONCE(cpudata->highest_perf);
 
-	return sprintf(&buf[0], "%u\n", perf);
+	return sysfs_emit(buf, "%u\n", perf);
 }
 
 static ssize_t show_energy_performance_available_preferences(