diff mbox

cpufreq/stats: Add "unknown" frequency field in stats tables

Message ID 528C4E6F.20507@linaro.org
State New
Headers show

Commit Message

Viresh Kumar Nov. 20, 2013, 5:53 a.m. UTC
On Tuesday 19 November 2013 11:10 AM, Viresh Kumar wrote:
> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> index 4cf0d28..ebb21cd 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -72,9 +72,13 @@ static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
>  		return 0;
>  	cpufreq_stats_update(stat->cpu);
>  	for (i = 0; i < stat->state_num; i++) {
> -		len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i],
> -			(unsigned long long)
> -			jiffies_64_to_clock_t(stat->time_in_state[i]));
> +		if (stat->freq_table[i] == -1)
> +			return sprintf(buf + len, "unknown");
> +		else
> +			return sprintf(buf + len, "%u", stat->freq_table[i]);
> +
> +		len += sprintf(buf + len, " %llu\n", (unsigned long long)
> +				jiffies_64_to_clock_t(stat->time_in_state[i]));
>  	}
>  	return len;

Somehow I forgot to add below fix with this patch, which I have tested at that time.


                                jiffies_64_to_clock_t(stat->time_in_state[i]));
diff mbox

Patch

diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index ebb21cd..89012d1 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -73,9 +73,9 @@  static ssize_t show_time_in_state(struct cpufreq_policy
*policy, char *buf)
        cpufreq_stats_update(stat->cpu);
        for (i = 0; i < stat->state_num; i++) {
                if (stat->freq_table[i] == -1)
-                       return sprintf(buf + len, "unknown");
+                       len+= sprintf(buf + len, "unknown");
                else
-                       return sprintf(buf + len, "%u", stat->freq_table[i]);
+                       len+= sprintf(buf + len, "%u", stat->freq_table[i]);

                len += sprintf(buf + len, " %llu\n", (unsigned long long)