Merge branches 'pm-domains', 'pm-sleep' and 'pm-tools'

* pm-domains:
  ARM: shmobile: Convert to genpd flags for PM clocks for R-mobile
  ARM: shmobile: Convert to genpd flags for PM clocks for r8a7779
  PM / Domains: Initial PM clock support for genpd
  PM / Domains: Power on the PM domain right after attach completes
  PM / Domains: Move struct pm_domain_data to pm_domain.h
  PM / Domains: Extract code to power off/on a PM domain
  PM / Domains: Make genpd parameter of pm_genpd_present() const

* pm-sleep:
  PM / hibernate: Deletion of an unnecessary check before the function call "vfree"
  PM / Hibernate: Migrate to ktime_t

* pm-tools:
  tools: cpupower: fix return checks for sysfs_get_idlestate_count()
This commit is contained in:
Rafael J. Wysocki 2014-12-08 20:00:02 +01:00
commit 389cbf36e5
10 changed files with 120 additions and 91 deletions

View File

@ -83,9 +83,8 @@ static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
{ {
struct generic_pm_domain *genpd = &r8a7779_pd->genpd; struct generic_pm_domain *genpd = &r8a7779_pd->genpd;
genpd->flags = GENPD_FLAG_PM_CLK;
pm_genpd_init(genpd, NULL, false); pm_genpd_init(genpd, NULL, false);
genpd->dev_ops.stop = pm_clk_suspend;
genpd->dev_ops.start = pm_clk_resume;
genpd->dev_ops.active_wakeup = pd_active_wakeup; genpd->dev_ops.active_wakeup = pd_active_wakeup;
genpd->power_off = pd_power_down; genpd->power_off = pd_power_down;
genpd->power_on = pd_power_up; genpd->power_on = pd_power_up;

View File

@ -106,9 +106,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
struct generic_pm_domain *genpd = &rmobile_pd->genpd; struct generic_pm_domain *genpd = &rmobile_pd->genpd;
struct dev_power_governor *gov = rmobile_pd->gov; struct dev_power_governor *gov = rmobile_pd->gov;
genpd->flags = GENPD_FLAG_PM_CLK;
pm_genpd_init(genpd, gov ? : &simple_qos_governor, false); pm_genpd_init(genpd, gov ? : &simple_qos_governor, false);
genpd->dev_ops.stop = pm_clk_suspend;
genpd->dev_ops.start = pm_clk_resume;
genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup;
genpd->power_off = rmobile_pd_power_down; genpd->power_off = rmobile_pd_power_down;
genpd->power_on = rmobile_pd_power_up; genpd->power_on = rmobile_pd_power_up;

View File

@ -12,6 +12,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/pm_domain.h> #include <linux/pm_domain.h>
#include <linux/pm_qos.h> #include <linux/pm_qos.h>
#include <linux/pm_clock.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/sched.h> #include <linux/sched.h>
@ -151,6 +152,59 @@ static void genpd_recalc_cpu_exit_latency(struct generic_pm_domain *genpd)
genpd->cpuidle_data->idle_state->exit_latency = usecs64; genpd->cpuidle_data->idle_state->exit_latency = usecs64;
} }
static int genpd_power_on(struct generic_pm_domain *genpd)
{
ktime_t time_start;
s64 elapsed_ns;
int ret;
if (!genpd->power_on)
return 0;
time_start = ktime_get();
ret = genpd->power_on(genpd);
if (ret)
return ret;
elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
if (elapsed_ns <= genpd->power_on_latency_ns)
return ret;
genpd->power_on_latency_ns = elapsed_ns;
genpd->max_off_time_changed = true;
genpd_recalc_cpu_exit_latency(genpd);
pr_warn("%s: Power-%s latency exceeded, new value %lld ns\n",
genpd->name, "on", elapsed_ns);
return ret;
}
static int genpd_power_off(struct generic_pm_domain *genpd)
{
ktime_t time_start;
s64 elapsed_ns;
int ret;
if (!genpd->power_off)
return 0;
time_start = ktime_get();
ret = genpd->power_off(genpd);
if (ret == -EBUSY)
return ret;
elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
if (elapsed_ns <= genpd->power_off_latency_ns)
return ret;
genpd->power_off_latency_ns = elapsed_ns;
genpd->max_off_time_changed = true;
pr_warn("%s: Power-%s latency exceeded, new value %lld ns\n",
genpd->name, "off", elapsed_ns);
return ret;
}
/** /**
* __pm_genpd_poweron - Restore power to a given PM domain and its masters. * __pm_genpd_poweron - Restore power to a given PM domain and its masters.
* @genpd: PM domain to power up. * @genpd: PM domain to power up.
@ -222,25 +276,9 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd)
} }
} }
if (genpd->power_on) { ret = genpd_power_on(genpd);
ktime_t time_start = ktime_get(); if (ret)
s64 elapsed_ns; goto err;
ret = genpd->power_on(genpd);
if (ret)
goto err;
elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
if (elapsed_ns > genpd->power_on_latency_ns) {
genpd->power_on_latency_ns = elapsed_ns;
genpd->max_off_time_changed = true;
genpd_recalc_cpu_exit_latency(genpd);
if (genpd->name)
pr_warning("%s: Power-on latency exceeded, "
"new value %lld ns\n", genpd->name,
elapsed_ns);
}
}
out: out:
genpd_set_active(genpd); genpd_set_active(genpd);
@ -544,16 +582,11 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd)
} }
if (genpd->power_off) { if (genpd->power_off) {
ktime_t time_start;
s64 elapsed_ns;
if (atomic_read(&genpd->sd_count) > 0) { if (atomic_read(&genpd->sd_count) > 0) {
ret = -EBUSY; ret = -EBUSY;
goto out; goto out;
} }
time_start = ktime_get();
/* /*
* If sd_count > 0 at this point, one of the subdomains hasn't * If sd_count > 0 at this point, one of the subdomains hasn't
* managed to call pm_genpd_poweron() for the master yet after * managed to call pm_genpd_poweron() for the master yet after
@ -562,21 +595,11 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd)
* the pm_genpd_poweron() restore power for us (this shouldn't * the pm_genpd_poweron() restore power for us (this shouldn't
* happen very often). * happen very often).
*/ */
ret = genpd->power_off(genpd); ret = genpd_power_off(genpd);
if (ret == -EBUSY) { if (ret == -EBUSY) {
genpd_set_active(genpd); genpd_set_active(genpd);
goto out; goto out;
} }
elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
if (elapsed_ns > genpd->power_off_latency_ns) {
genpd->power_off_latency_ns = elapsed_ns;
genpd->max_off_time_changed = true;
if (genpd->name)
pr_warning("%s: Power-off latency exceeded, "
"new value %lld ns\n", genpd->name,
elapsed_ns);
}
} }
genpd->status = GPD_STATE_POWER_OFF; genpd->status = GPD_STATE_POWER_OFF;
@ -779,9 +802,9 @@ static inline void genpd_power_off_work_fn(struct work_struct *work) {}
* pm_genpd_present - Check if the given PM domain has been initialized. * pm_genpd_present - Check if the given PM domain has been initialized.
* @genpd: PM domain to check. * @genpd: PM domain to check.
*/ */
static bool pm_genpd_present(struct generic_pm_domain *genpd) static bool pm_genpd_present(const struct generic_pm_domain *genpd)
{ {
struct generic_pm_domain *gpd; const struct generic_pm_domain *gpd;
if (IS_ERR_OR_NULL(genpd)) if (IS_ERR_OR_NULL(genpd))
return false; return false;
@ -822,8 +845,7 @@ static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd)
|| atomic_read(&genpd->sd_count) > 0) || atomic_read(&genpd->sd_count) > 0)
return; return;
if (genpd->power_off) genpd_power_off(genpd);
genpd->power_off(genpd);
genpd->status = GPD_STATE_POWER_OFF; genpd->status = GPD_STATE_POWER_OFF;
@ -854,8 +876,7 @@ static void pm_genpd_sync_poweron(struct generic_pm_domain *genpd)
genpd_sd_counter_inc(link->master); genpd_sd_counter_inc(link->master);
} }
if (genpd->power_on) genpd_power_on(genpd);
genpd->power_on(genpd);
genpd->status = GPD_STATE_ACTIVE; genpd->status = GPD_STATE_ACTIVE;
} }
@ -1277,8 +1298,7 @@ static int pm_genpd_restore_noirq(struct device *dev)
* If the domain was off before the hibernation, make * If the domain was off before the hibernation, make
* sure it will be off going forward. * sure it will be off going forward.
*/ */
if (genpd->power_off) genpd_power_off(genpd);
genpd->power_off(genpd);
return 0; return 0;
} }
@ -1929,6 +1949,12 @@ void pm_genpd_init(struct generic_pm_domain *genpd,
genpd->domain.ops.complete = pm_genpd_complete; genpd->domain.ops.complete = pm_genpd_complete;
genpd->dev_ops.save_state = pm_genpd_default_save_state; genpd->dev_ops.save_state = pm_genpd_default_save_state;
genpd->dev_ops.restore_state = pm_genpd_default_restore_state; genpd->dev_ops.restore_state = pm_genpd_default_restore_state;
if (genpd->flags & GENPD_FLAG_PM_CLK) {
genpd->dev_ops.stop = pm_clk_suspend;
genpd->dev_ops.start = pm_clk_resume;
}
mutex_lock(&gpd_list_lock); mutex_lock(&gpd_list_lock);
list_add(&genpd->gpd_list_node, &gpd_list); list_add(&genpd->gpd_list_node, &gpd_list);
mutex_unlock(&gpd_list_lock); mutex_unlock(&gpd_list_lock);
@ -2216,6 +2242,7 @@ int genpd_dev_pm_attach(struct device *dev)
} }
dev->pm_domain->detach = genpd_dev_pm_detach; dev->pm_domain->detach = genpd_dev_pm_detach;
pm_genpd_poweron(pd);
return 0; return 0;
} }

View File

@ -538,11 +538,7 @@ enum rpm_request {
}; };
struct wakeup_source; struct wakeup_source;
struct pm_domain_data;
struct pm_domain_data {
struct list_head list_node;
struct device *dev;
};
struct pm_subsys_data { struct pm_subsys_data {
spinlock_t lock; spinlock_t lock;

View File

@ -17,6 +17,9 @@
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/cpuidle.h> #include <linux/cpuidle.h>
/* Defines used for the flags field in the struct generic_pm_domain */
#define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */
enum gpd_status { enum gpd_status {
GPD_STATE_ACTIVE = 0, /* PM domain is active */ GPD_STATE_ACTIVE = 0, /* PM domain is active */
GPD_STATE_WAIT_MASTER, /* PM domain's master is being waited for */ GPD_STATE_WAIT_MASTER, /* PM domain's master is being waited for */
@ -76,6 +79,7 @@ struct generic_pm_domain {
struct device *dev); struct device *dev);
void (*detach_dev)(struct generic_pm_domain *domain, void (*detach_dev)(struct generic_pm_domain *domain,
struct device *dev); struct device *dev);
unsigned int flags; /* Bit field of configs for genpd */
}; };
static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@ -100,6 +104,11 @@ struct gpd_timing_data {
bool cached_stop_ok; bool cached_stop_ok;
}; };
struct pm_domain_data {
struct list_head list_node;
struct device *dev;
};
struct generic_pm_domain_data { struct generic_pm_domain_data {
struct pm_domain_data base; struct pm_domain_data base;
struct gpd_timing_data td; struct gpd_timing_data td;

View File

@ -28,6 +28,7 @@
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/genhd.h> #include <linux/genhd.h>
#include <linux/ktime.h>
#include <trace/events/power.h> #include <trace/events/power.h>
#include "power.h" #include "power.h"
@ -232,20 +233,17 @@ static void platform_recover(int platform_mode)
* @nr_pages: Number of memory pages processed between @start and @stop. * @nr_pages: Number of memory pages processed between @start and @stop.
* @msg: Additional diagnostic message to print. * @msg: Additional diagnostic message to print.
*/ */
void swsusp_show_speed(struct timeval *start, struct timeval *stop, void swsusp_show_speed(ktime_t start, ktime_t stop,
unsigned nr_pages, char *msg) unsigned nr_pages, char *msg)
{ {
ktime_t diff;
u64 elapsed_centisecs64; u64 elapsed_centisecs64;
unsigned int centisecs; unsigned int centisecs;
unsigned int k; unsigned int k;
unsigned int kps; unsigned int kps;
elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start); diff = ktime_sub(stop, start);
/* elapsed_centisecs64 = ktime_divns(diff, 10*NSEC_PER_MSEC);
* If "(s64)elapsed_centisecs64 < 0", it will print long elapsed time,
* it is obvious enough for what went wrong.
*/
do_div(elapsed_centisecs64, NSEC_PER_SEC / 100);
centisecs = elapsed_centisecs64; centisecs = elapsed_centisecs64;
if (centisecs == 0) if (centisecs == 0)
centisecs = 1; /* avoid div-by-zero */ centisecs = 1; /* avoid div-by-zero */

View File

@ -174,8 +174,7 @@ extern int hib_wait_on_bio_chain(struct bio **bio_chain);
struct timeval; struct timeval;
/* kernel/power/swsusp.c */ /* kernel/power/swsusp.c */
extern void swsusp_show_speed(struct timeval *, struct timeval *, extern void swsusp_show_speed(ktime_t, ktime_t, unsigned int, char *);
unsigned int, char *);
#ifdef CONFIG_SUSPEND #ifdef CONFIG_SUSPEND
/* kernel/power/suspend.c */ /* kernel/power/suspend.c */

View File

@ -28,6 +28,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/ktime.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
@ -1576,11 +1577,11 @@ int hibernate_preallocate_memory(void)
struct zone *zone; struct zone *zone;
unsigned long saveable, size, max_size, count, highmem, pages = 0; unsigned long saveable, size, max_size, count, highmem, pages = 0;
unsigned long alloc, save_highmem, pages_highmem, avail_normal; unsigned long alloc, save_highmem, pages_highmem, avail_normal;
struct timeval start, stop; ktime_t start, stop;
int error; int error;
printk(KERN_INFO "PM: Preallocating image memory... "); printk(KERN_INFO "PM: Preallocating image memory... ");
do_gettimeofday(&start); start = ktime_get();
error = memory_bm_create(&orig_bm, GFP_IMAGE, PG_ANY); error = memory_bm_create(&orig_bm, GFP_IMAGE, PG_ANY);
if (error) if (error)
@ -1709,9 +1710,9 @@ int hibernate_preallocate_memory(void)
free_unnecessary_pages(); free_unnecessary_pages();
out: out:
do_gettimeofday(&stop); stop = ktime_get();
printk(KERN_CONT "done (allocated %lu pages)\n", pages); printk(KERN_CONT "done (allocated %lu pages)\n", pages);
swsusp_show_speed(&start, &stop, pages, "Allocated"); swsusp_show_speed(start, stop, pages, "Allocated");
return 0; return 0;

View File

@ -30,6 +30,7 @@
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/ktime.h>
#include "power.h" #include "power.h"
@ -445,8 +446,8 @@ static int save_image(struct swap_map_handle *handle,
int nr_pages; int nr_pages;
int err2; int err2;
struct bio *bio; struct bio *bio;
struct timeval start; ktime_t start;
struct timeval stop; ktime_t stop;
printk(KERN_INFO "PM: Saving image data pages (%u pages)...\n", printk(KERN_INFO "PM: Saving image data pages (%u pages)...\n",
nr_to_write); nr_to_write);
@ -455,7 +456,7 @@ static int save_image(struct swap_map_handle *handle,
m = 1; m = 1;
nr_pages = 0; nr_pages = 0;
bio = NULL; bio = NULL;
do_gettimeofday(&start); start = ktime_get();
while (1) { while (1) {
ret = snapshot_read_next(snapshot); ret = snapshot_read_next(snapshot);
if (ret <= 0) if (ret <= 0)
@ -469,12 +470,12 @@ static int save_image(struct swap_map_handle *handle,
nr_pages++; nr_pages++;
} }
err2 = hib_wait_on_bio_chain(&bio); err2 = hib_wait_on_bio_chain(&bio);
do_gettimeofday(&stop); stop = ktime_get();
if (!ret) if (!ret)
ret = err2; ret = err2;
if (!ret) if (!ret)
printk(KERN_INFO "PM: Image saving done.\n"); printk(KERN_INFO "PM: Image saving done.\n");
swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); swsusp_show_speed(start, stop, nr_to_write, "Wrote");
return ret; return ret;
} }
@ -580,8 +581,8 @@ static int save_image_lzo(struct swap_map_handle *handle,
int nr_pages; int nr_pages;
int err2; int err2;
struct bio *bio; struct bio *bio;
struct timeval start; ktime_t start;
struct timeval stop; ktime_t stop;
size_t off; size_t off;
unsigned thr, run_threads, nr_threads; unsigned thr, run_threads, nr_threads;
unsigned char *page = NULL; unsigned char *page = NULL;
@ -674,7 +675,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
m = 1; m = 1;
nr_pages = 0; nr_pages = 0;
bio = NULL; bio = NULL;
do_gettimeofday(&start); start = ktime_get();
for (;;) { for (;;) {
for (thr = 0; thr < nr_threads; thr++) { for (thr = 0; thr < nr_threads; thr++) {
for (off = 0; off < LZO_UNC_SIZE; off += PAGE_SIZE) { for (off = 0; off < LZO_UNC_SIZE; off += PAGE_SIZE) {
@ -759,12 +760,12 @@ static int save_image_lzo(struct swap_map_handle *handle,
out_finish: out_finish:
err2 = hib_wait_on_bio_chain(&bio); err2 = hib_wait_on_bio_chain(&bio);
do_gettimeofday(&stop); stop = ktime_get();
if (!ret) if (!ret)
ret = err2; ret = err2;
if (!ret) if (!ret)
printk(KERN_INFO "PM: Image saving done.\n"); printk(KERN_INFO "PM: Image saving done.\n");
swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); swsusp_show_speed(start, stop, nr_to_write, "Wrote");
out_clean: out_clean:
if (crc) { if (crc) {
if (crc->thr) if (crc->thr)
@ -965,8 +966,8 @@ static int load_image(struct swap_map_handle *handle,
{ {
unsigned int m; unsigned int m;
int ret = 0; int ret = 0;
struct timeval start; ktime_t start;
struct timeval stop; ktime_t stop;
struct bio *bio; struct bio *bio;
int err2; int err2;
unsigned nr_pages; unsigned nr_pages;
@ -978,7 +979,7 @@ static int load_image(struct swap_map_handle *handle,
m = 1; m = 1;
nr_pages = 0; nr_pages = 0;
bio = NULL; bio = NULL;
do_gettimeofday(&start); start = ktime_get();
for ( ; ; ) { for ( ; ; ) {
ret = snapshot_write_next(snapshot); ret = snapshot_write_next(snapshot);
if (ret <= 0) if (ret <= 0)
@ -996,7 +997,7 @@ static int load_image(struct swap_map_handle *handle,
nr_pages++; nr_pages++;
} }
err2 = hib_wait_on_bio_chain(&bio); err2 = hib_wait_on_bio_chain(&bio);
do_gettimeofday(&stop); stop = ktime_get();
if (!ret) if (!ret)
ret = err2; ret = err2;
if (!ret) { if (!ret) {
@ -1005,7 +1006,7 @@ static int load_image(struct swap_map_handle *handle,
if (!snapshot_image_loaded(snapshot)) if (!snapshot_image_loaded(snapshot))
ret = -ENODATA; ret = -ENODATA;
} }
swsusp_show_speed(&start, &stop, nr_to_read, "Read"); swsusp_show_speed(start, stop, nr_to_read, "Read");
return ret; return ret;
} }
@ -1067,8 +1068,8 @@ static int load_image_lzo(struct swap_map_handle *handle,
int ret = 0; int ret = 0;
int eof = 0; int eof = 0;
struct bio *bio; struct bio *bio;
struct timeval start; ktime_t start;
struct timeval stop; ktime_t stop;
unsigned nr_pages; unsigned nr_pages;
size_t off; size_t off;
unsigned i, thr, run_threads, nr_threads; unsigned i, thr, run_threads, nr_threads;
@ -1190,7 +1191,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
m = 1; m = 1;
nr_pages = 0; nr_pages = 0;
bio = NULL; bio = NULL;
do_gettimeofday(&start); start = ktime_get();
ret = snapshot_write_next(snapshot); ret = snapshot_write_next(snapshot);
if (ret <= 0) if (ret <= 0)
@ -1343,7 +1344,7 @@ out_finish:
wait_event(crc->done, atomic_read(&crc->stop)); wait_event(crc->done, atomic_read(&crc->stop));
atomic_set(&crc->stop, 0); atomic_set(&crc->stop, 0);
} }
do_gettimeofday(&stop); stop = ktime_get();
if (!ret) { if (!ret) {
printk(KERN_INFO "PM: Image loading done.\n"); printk(KERN_INFO "PM: Image loading done.\n");
snapshot_write_finalize(snapshot); snapshot_write_finalize(snapshot);
@ -1359,7 +1360,7 @@ out_finish:
} }
} }
} }
swsusp_show_speed(&start, &stop, nr_to_read, "Read"); swsusp_show_speed(start, stop, nr_to_read, "Read");
out_clean: out_clean:
for (i = 0; i < ring_size; i++) for (i = 0; i < ring_size; i++)
free_page((unsigned long)page[i]); free_page((unsigned long)page[i]);
@ -1374,7 +1375,7 @@ out_clean:
kthread_stop(data[thr].thr); kthread_stop(data[thr].thr);
vfree(data); vfree(data);
} }
if (page) vfree(page); vfree(page);
return ret; return ret;
} }

View File

@ -22,13 +22,13 @@
static void cpuidle_cpu_output(unsigned int cpu, int verbose) static void cpuidle_cpu_output(unsigned int cpu, int verbose)
{ {
unsigned int idlestates, idlestate; int idlestates, idlestate;
char *tmp; char *tmp;
printf(_ ("Analyzing CPU %d:\n"), cpu); printf(_ ("Analyzing CPU %d:\n"), cpu);
idlestates = sysfs_get_idlestate_count(cpu); idlestates = sysfs_get_idlestate_count(cpu);
if (idlestates == 0) { if (idlestates < 1) {
printf(_("CPU %u: No idle states\n"), cpu); printf(_("CPU %u: No idle states\n"), cpu);
return; return;
} }
@ -100,10 +100,10 @@ static void cpuidle_general_output(void)
static void proc_cpuidle_cpu_output(unsigned int cpu) static void proc_cpuidle_cpu_output(unsigned int cpu)
{ {
long max_allowed_cstate = 2000000000; long max_allowed_cstate = 2000000000;
unsigned int cstate, cstates; int cstate, cstates;
cstates = sysfs_get_idlestate_count(cpu); cstates = sysfs_get_idlestate_count(cpu);
if (cstates == 0) { if (cstates < 1) {
printf(_("CPU %u: No C-states info\n"), cpu); printf(_("CPU %u: No C-states info\n"), cpu);
return; return;
} }