[S390] cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 26 Mar 2009 14:24:59 +0000 (15:24 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 26 Mar 2009 14:24:33 +0000 (15:24 +0100)
Impact: cleanup, futureproof

In fact, all cpumask ops will only be valid (in general) for bit
numbers < nr_cpu_ids.  So use that instead of NR_CPUS in various
places (I also updated the immediate sites to use the new cpumask_
operators).

This is always safe: no cpu number can be >= nr_cpu_ids, and
nr_cpu_ids is initialized to NR_CPUS at boot.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/smp.c

index fe5f8dc1e6fa096aa202a03e9274fc362dc3b7bf..13052a4ed71d4de2d0d62bdbf0abc88e263fd585 100644 (file)
@@ -297,8 +297,8 @@ static int smp_rescan_cpus_sigp(cpumask_t avail)
 {
        int cpu_id, logical_cpu;
 
-       logical_cpu = first_cpu(avail);
-       if (logical_cpu == NR_CPUS)
+       logical_cpu = cpumask_first(&avail);
+       if (logical_cpu >= nr_cpu_ids)
                return 0;
        for (cpu_id = 0; cpu_id <= 65535; cpu_id++) {
                if (cpu_known(cpu_id))
@@ -309,8 +309,8 @@ static int smp_rescan_cpus_sigp(cpumask_t avail)
                        continue;
                cpu_set(logical_cpu, cpu_present_map);
                smp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
-               logical_cpu = next_cpu(logical_cpu, avail);
-               if (logical_cpu == NR_CPUS)
+               logical_cpu = cpumask_next(logical_cpu, &avail);
+               if (logical_cpu >= nr_cpu_ids)
                        break;
        }
        return 0;
@@ -322,8 +322,8 @@ static int smp_rescan_cpus_sclp(cpumask_t avail)
        int cpu_id, logical_cpu, cpu;
        int rc;
 
-       logical_cpu = first_cpu(avail);
-       if (logical_cpu == NR_CPUS)
+       logical_cpu = cpumask_first(&avail);
+       if (logical_cpu >= nr_cpu_ids)
                return 0;
        info = kmalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
@@ -344,8 +344,8 @@ static int smp_rescan_cpus_sclp(cpumask_t avail)
                        smp_cpu_state[logical_cpu] = CPU_STATE_STANDBY;
                else
                        smp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
-               logical_cpu = next_cpu(logical_cpu, avail);
-               if (logical_cpu == NR_CPUS)
+               logical_cpu = cpumask_next(logical_cpu, &avail);
+               if (logical_cpu >= nr_cpu_ids)
                        break;
        }
 out:
@@ -591,7 +591,7 @@ static int __init setup_possible_cpus(char *s)
 
        pcpus = simple_strtoul(s, NULL, 0);
        cpu_possible_map = cpumask_of_cpu(0);
-       for (cpu = 1; cpu < pcpus && cpu < NR_CPUS; cpu++)
+       for (cpu = 1; cpu < pcpus && cpu < nr_cpu_ids; cpu++)
                cpu_set(cpu, cpu_possible_map);
        return 0;
 }