linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: viresh kumar <viresh.kumar@linaro.org>
To: rjw@rjwysocki.net
Cc: linaro-kernel@lists.linaro.org, patches@linaro.org,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, nm@ti.com, shawn.guo@linaro.org,
	ceh@ti.com, Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH] cpufreq/stats: Add "unknown" frequency field in stats tables
Date: Wed, 20 Nov 2013 11:23:51 +0530	[thread overview]
Message-ID: <528C4E6F.20507@linaro.org> (raw)
In-Reply-To: <b0a2e5d26be45d1d2853940d318d50415db48f6f.1384839287.git.viresh.kumar@linaro.org>

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.


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)
                                jiffies_64_to_clock_t(stat->time_in_state[i]));


      parent reply	other threads:[~2013-11-20  5:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19  5:40 [PATCH] cpufreq/stats: Add "unknown" frequency field in stats tables Viresh Kumar
2013-11-19  8:42 ` Jon Medhurst (Tixy)
2013-11-19 14:22   ` Viresh Kumar
2013-11-20  5:53 ` viresh kumar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528C4E6F.20507@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=ceh@ti.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=patches@linaro.org \
    --cc=rjw@rjwysocki.net \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).