cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: mips
From: Rusty Russell <rusty@rustcorp.com.au>

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.

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>
---
 arch/mips/kernel/irq-gic.c     |    2 +-
 arch/mips/kernel/proc.c        |    2 +-
 arch/mips/kernel/smp-cmp.c     |    2 +-
 arch/mips/kernel/smtc.c        |    6 +++---
 arch/mips/sibyte/bcm1480/irq.c |    2 +-
 arch/mips/sibyte/bcm1480/smp.c |    2 +-
 arch/mips/sibyte/sb1250/smp.c  |    2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff -r e9095efe04e2 arch/mips/kernel/irq-gic.c
--- a/arch/mips/kernel/irq-gic.c	Tue Nov 18 21:09:42 2008 +1030
+++ b/arch/mips/kernel/irq-gic.c	Tue Nov 18 21:11:31 2008 +1030
@@ -182,7 +182,7 @@
 		_intrmap[irq].cpunum = first_cpu(tmp);
 
 		/* Update the pcpu_masks */
-		for (i = 0; i < NR_CPUS; i++)
+		for (i = 0; i < nr_cpu_ids; i++)
 			clear_bit(irq, pcpu_masks[i].pcpu_mask);
 		set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
 
diff -r e9095efe04e2 arch/mips/kernel/proc.c
--- a/arch/mips/kernel/proc.c	Tue Nov 18 21:09:42 2008 +1030
+++ b/arch/mips/kernel/proc.c	Tue Nov 18 21:11:31 2008 +1030
@@ -86,7 +86,7 @@
 {
 	unsigned long i = *pos;
 
-	return i < NR_CPUS ? (void *) (i + 1) : NULL;
+	return i < nr_cpu_ids ? (void *) (i + 1) : NULL;
 }
 
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
diff -r e9095efe04e2 arch/mips/kernel/smp-cmp.c
--- a/arch/mips/kernel/smp-cmp.c	Tue Nov 18 21:09:42 2008 +1030
+++ b/arch/mips/kernel/smp-cmp.c	Tue Nov 18 21:11:31 2008 +1030
@@ -224,7 +224,7 @@
 		cpu_set(0, mt_fpu_cpumask);
 #endif /* CONFIG_MIPS_MT_FPAFF */
 
-	for (i = 1; i < NR_CPUS; i++) {
+	for (i = 1; i < nr_cpu_ids; i++) {
 		if (amon_cpu_avail(i)) {
 			cpu_set(i, cpu_possible_map);
 			__cpu_number_map[i]	= ++ncpu;
diff -r e9095efe04e2 arch/mips/kernel/smtc.c
--- a/arch/mips/kernel/smtc.c	Tue Nov 18 21:09:42 2008 +1030
+++ b/arch/mips/kernel/smtc.c	Tue Nov 18 21:11:31 2008 +1030
@@ -422,8 +422,8 @@
 	if (vpelimit > 0 && nvpe > vpelimit)
 		nvpe = vpelimit;
 	ntc = ((val & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
-	if (ntc > NR_CPUS)
-		ntc = NR_CPUS;
+	if (ntc > nr_cpu_ids)
+		ntc = nr_cpu_ids;
 	if (tclimit > 0 && ntc > tclimit)
 		ntc = tclimit;
 	slop = ntc % nvpe;
@@ -701,7 +701,7 @@
 	 */
 
 	/* If no one is eligible, service locally */
-	if (target >= NR_CPUS) {
+	if (target >= nr_cpu_ids) {
 		do_IRQ_no_affinity(irq);
 		return;
 	}
diff -r e9095efe04e2 arch/mips/sibyte/bcm1480/irq.c
--- a/arch/mips/sibyte/bcm1480/irq.c	Tue Nov 18 21:09:42 2008 +1030
+++ b/arch/mips/sibyte/bcm1480/irq.c	Tue Nov 18 21:11:31 2008 +1030
@@ -195,7 +195,7 @@
 		if (pending) {
 #ifdef CONFIG_SMP
 			int i;
-			for (i=0; i<NR_CPUS; i++) {
+			for (i = 0; i < nr_cpu_ids; i++) {
 				/*
 				 * Clear for all CPUs so an affinity switch
 				 * doesn't find an old status
diff -r e9095efe04e2 arch/mips/sibyte/bcm1480/smp.c
--- a/arch/mips/sibyte/bcm1480/smp.c	Tue Nov 18 21:09:42 2008 +1030
+++ b/arch/mips/sibyte/bcm1480/smp.c	Tue Nov 18 21:11:31 2008 +1030
@@ -150,7 +150,7 @@
 	__cpu_number_map[0] = 0;
 	__cpu_logical_map[0] = 0;
 
-	for (i = 1, num = 0; i < NR_CPUS; i++) {
+	for (i = 1, num = 0; i < nr_cpu_ids; i++) {
 		if (cfe_cpu_stop(i) == 0) {
 			cpu_set(i, cpu_possible_map);
 			__cpu_number_map[i] = ++num;
diff -r e9095efe04e2 arch/mips/sibyte/sb1250/smp.c
--- a/arch/mips/sibyte/sb1250/smp.c	Tue Nov 18 21:09:42 2008 +1030
+++ b/arch/mips/sibyte/sb1250/smp.c	Tue Nov 18 21:11:31 2008 +1030
@@ -138,7 +138,7 @@
 	__cpu_number_map[0] = 0;
 	__cpu_logical_map[0] = 0;
 
-	for (i = 1, num = 0; i < NR_CPUS; i++) {
+	for (i = 1, num = 0; i < nr_cpu_ids; i++) {
 		if (cfe_cpu_stop(i) == 0) {
 			cpu_set(i, cpu_possible_map);
 			__cpu_number_map[i] = ++num;
