Commit cc216b86e51e9ab22265ea9591769c9ee235e1e4

Authored by Rusty Russell
1 parent 6957177f5c

cpumask: convert drivers/idle/i7300_idle.c to cpumask_var_t

Fairly simple transformation:
1) cpumask_t -> cpumask_var_t and alloc_cpumask_var/free_cpumask_var
   (which are a NOOP unless CONFIG_CPUMASK_OFFSTACK=y).
2) cpu_set -> cpumask_set_cpu
3) cpus_weight -> cpumask_weight
4) cpu_clear -> cpumask_clear_cpu

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
To: Andy Henroid <andrew.d.henroid@intel.com>

Showing 1 changed file with 9 additions and 6 deletions Side-by-side Diff

drivers/idle/i7300_idle.c
... ... @@ -81,7 +81,7 @@
81 81 static u8 i7300_idle_thrtlow_saved;
82 82 static u32 i7300_idle_mc_saved;
83 83  
84   -static cpumask_t idle_cpumask;
  84 +static cpumask_var_t idle_cpumask;
85 85 static ktime_t start_ktime;
86 86 static unsigned long avg_idle_us;
87 87  
88 88  
... ... @@ -459,9 +459,9 @@
459 459 spin_lock_irqsave(&i7300_idle_lock, flags);
460 460 if (val == IDLE_START) {
461 461  
462   - cpu_set(smp_processor_id(), idle_cpumask);
  462 + cpumask_set_cpu(smp_processor_id(), idle_cpumask);
463 463  
464   - if (cpus_weight(idle_cpumask) != num_online_cpus())
  464 + if (cpumask_weight(idle_cpumask) != num_online_cpus())
465 465 goto end;
466 466  
467 467 now_ktime = ktime_get();
... ... @@ -478,8 +478,8 @@
478 478 i7300_idle_ioat_start();
479 479  
480 480 } else if (val == IDLE_END) {
481   - cpu_clear(smp_processor_id(), idle_cpumask);
482   - if (cpus_weight(idle_cpumask) == (num_online_cpus() - 1)) {
  481 + cpumask_clear_cpu(smp_processor_id(), idle_cpumask);
  482 + if (cpumask_weight(idle_cpumask) == (num_online_cpus() - 1)) {
483 483 /* First CPU coming out of idle */
484 484 u64 idle_duration_us;
485 485  
... ... @@ -553,7 +553,6 @@
553 553 static int __init i7300_idle_init(void)
554 554 {
555 555 spin_lock_init(&i7300_idle_lock);
556   - cpus_clear(idle_cpumask);
557 556 total_us = 0;
558 557  
559 558 if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev, forceload))
... ... @@ -565,6 +564,9 @@
565 564 if (i7300_idle_ioat_init())
566 565 return -ENODEV;
567 566  
  567 + if (!zalloc_cpumask_var(&idle_cpumask, GFP_KERNEL))
  568 + return -ENOMEM;
  569 +
568 570 debugfs_dir = debugfs_create_dir("i7300_idle", NULL);
569 571 if (debugfs_dir) {
570 572 int i = 0;
... ... @@ -589,6 +591,7 @@
589 591 static void __exit i7300_idle_exit(void)
590 592 {
591 593 idle_notifier_unregister(&i7300_idle_nb);
  594 + free_cpumask_var(idle_cpumask);
592 595  
593 596 if (debugfs_dir) {
594 597 int i = 0;