public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH 2/2] Fix no idle state information return value
Date: Wed, 17 Dec 2014 17:27:01 +0100	[thread overview]
Message-ID: <1494685.HIEjl338tW@skinner> (raw)
In-Reply-To: <1418565998-3701-3-git-send-email-prarit@redhat.com>

On Sunday, December 14, 2014 09:06:38 AM Prarit Bhargava wrote:
> sysfs_get_idlestate_count() returns an unsigned int.  Returning -ENODEV
> is not the right thing to do here, and in any case is handled the same
> way as if there are no states found.
Yep, returning zero states instead of an error code makes a lot sense
here.

> 
> Cc: Thomas Renninger <trenn@suse.de>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Thomas Renninger <trenn@suse.de>

Thanks!

    Thomas

> ---
>  tools/power/cpupower/utils/helpers/sysfs.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/power/cpupower/utils/helpers/sysfs.c
> b/tools/power/cpupower/utils/helpers/sysfs.c index 09afe5d..4e8fe2c 100644
> --- a/tools/power/cpupower/utils/helpers/sysfs.c
> +++ b/tools/power/cpupower/utils/helpers/sysfs.c
> @@ -361,7 +361,7 @@ unsigned int sysfs_get_idlestate_count(unsigned int cpu)
> 
>  	snprintf(file, SYSFS_PATH_MAX, PATH_TO_CPU "cpuidle");
>  	if (stat(file, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode))
> -		return -ENODEV;
> +		return 0;
> 
>  	snprintf(file, SYSFS_PATH_MAX, PATH_TO_CPU "cpu%u/cpuidle/state0", 
cpu);
>  	if (stat(file, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode))


  reply	other threads:[~2014-12-17 16:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-14 14:06 [PATCH 0/2] Properly fix sysfs_get_idlestate_count() Prarit Bhargava
2014-12-14 14:06 ` [PATCH 1/2] Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_count()" Prarit Bhargava
2014-12-14 14:06 ` [PATCH 2/2] Fix no idle state information return value Prarit Bhargava
2014-12-17 16:27   ` Thomas Renninger [this message]
2014-12-14 21:30 ` [PATCH 0/2] Properly fix sysfs_get_idlestate_count() Rafael J. Wysocki

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=1494685.HIEjl338tW@skinner \
    --to=trenn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    /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