cpumask: make CONFIG_NR_CPUS always valid.

Currently we have NR_CPUS, which is 1 on UP, and CONFIG_NR_CPUS on
SMP.  If we make CONFIG_NR_CPUS always valid (and always 1 on !SMP),
we can skip the middleman.

This also allows us to find and check all the remaining NR_CPUS users.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 arch/alpha/Kconfig      |   10 +++++-----
 arch/arm/Kconfig        |    6 +++---
 arch/ia64/Kconfig       |    8 ++++----
 arch/m32r/Kconfig       |    8 ++++----
 arch/mips/Kconfig       |    4 ++--
 arch/parisc/Kconfig     |    8 ++++----
 arch/s390/Kconfig       |   10 +++++-----
 arch/sh/Kconfig         |   10 +++++-----
 arch/sparc/Kconfig      |    8 ++++----
 arch/sparc64/Kconfig    |    8 ++++----
 arch/um/Kconfig         |    8 ++++----
 arch/x86/Kconfig        |   10 +++++-----
 include/linux/threads.h |   10 ++--------
 13 files changed, 51 insertions(+), 57 deletions(-)

diff -r cd452a3dfc5c arch/alpha/Kconfig
--- a/arch/alpha/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/alpha/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -546,11 +546,11 @@ config HAVE_DEC_LOCK
 	default y
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "32" if ALPHA_GENERIC || ALPHA_MARVEL
-	default "4" if !ALPHA_GENERIC && !ALPHA_MARVEL
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "32" if SMP && (ALPHA_GENERIC || ALPHA_MARVEL)
+	default "4" if SMP && (!ALPHA_GENERIC && !ALPHA_MARVEL)
 	help
 	  MARVEL support can handle a maximum of 32 CPUs, all the others
           with working support have a maximum of 4 CPUs.
diff -r cd452a3dfc5c arch/arm/Kconfig
--- a/arch/arm/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/arm/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -735,9 +735,9 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
 	default "4"
 
 config HOTPLUG_CPU
diff -r cd452a3dfc5c arch/ia64/Kconfig
--- a/arch/ia64/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/ia64/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -321,10 +321,10 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-4096)"
-	range 2 4096
-	depends on SMP
-	default "4096"
+	int "Maximum number of CPUs (2-4096)" if SMP
+	range 2 4096 if SMP
+	default "1" if !SMP
+	default "4096" if SMP
 	help
 	  You should set this to the number of CPUs in your system, but
 	  keep in mind that a kernel compiled for, e.g., 2 CPUs will boot but
diff -r cd452a3dfc5c arch/m32r/Kconfig
--- a/arch/m32r/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/m32r/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -323,10 +323,10 @@ config CHIP_M32700_TS1
 	default n
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "2"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "2" if SMP
 	help
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  The maximum supported value is 32 and the
diff -r cd452a3dfc5c arch/mips/Kconfig
--- a/arch/mips/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/mips/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -1718,9 +1718,9 @@ config NR_CPUS_DEFAULT_64
 	bool
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-64)"
+	int "Maximum number of CPUs (2-64)" if SMP
 	range 1 64 if NR_CPUS_DEFAULT_1
-	depends on SMP
+	default "1" if !SMP
 	default "1" if NR_CPUS_DEFAULT_1
 	default "2" if NR_CPUS_DEFAULT_2
 	default "4" if NR_CPUS_DEFAULT_4
diff -r cd452a3dfc5c arch/parisc/Kconfig
--- a/arch/parisc/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/parisc/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -254,10 +254,10 @@ config HPUX
 	depends on !64BIT
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "32"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "32" if SMP
 
 endmenu
 
diff -r cd452a3dfc5c arch/s390/Kconfig
--- a/arch/s390/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/s390/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -112,11 +112,11 @@ config SMP
 	  Even if you don't know what to do here, say Y.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-64)"
-	range 2 64
-	depends on SMP
-	default "32" if !64BIT
-	default "64" if 64BIT
+	int "Maximum number of CPUs (2-64)" if SMP
+	range 2 64 if SMP
+	default "1" if !SMP
+	default "32" if SMP && !64BIT
+	default "64" if SMP && 64BIT
 	help
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  The maximum supported value is 64 and the
diff -r cd452a3dfc5c arch/sh/Kconfig
--- a/arch/sh/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/sh/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -528,11 +528,11 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "4" if CPU_SHX3
-	default "2"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "4" if SMP && CPU_SHX3
+	default "2" if SMP
 	help
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  The maximum supported value is 32 and the
diff -r cd452a3dfc5c arch/sparc/Kconfig
--- a/arch/sparc/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/sparc/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -57,10 +57,10 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "32"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if SMP
+	default "32" if SMP
 
 config SPARC
 	bool
diff -r cd452a3dfc5c arch/sparc64/Kconfig
--- a/arch/sparc64/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/sparc64/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -156,10 +156,10 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-1024)"
-	range 2 1024
-	depends on SMP
-	default "64"
+	int "Maximum number of CPUs (2-1024)" if SMP
+	range 2 1024 if SMP
+	default "1" if !SMP
+	default "64" if SMP
 
 source "drivers/cpufreq/Kconfig"
 
diff -r cd452a3dfc5c arch/um/Kconfig
--- a/arch/um/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/um/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -198,10 +198,10 @@ config SMP
 	  If you don't know what to do, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "32"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "32" if SMP
 
 config HIGHMEM
 	bool "Highmem support (EXPERIMENTAL)"
diff -r cd452a3dfc5c arch/x86/Kconfig
--- a/arch/x86/Kconfig	Sun Sep 28 14:47:58 2008 +1000
+++ b/arch/x86/Kconfig	Sun Sep 28 15:17:24 2008 +1000
@@ -588,12 +588,12 @@ config MAXSMP
 	  If unsure, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-512)" if !MAXSMP
-	range 2 512
-	depends on SMP
+	int "Maximum number of CPUs (2-512)" if SMP && !MAXSMP
+	range 2 512 if SMP
+	default "1" if !SMP
 	default "4096" if MAXSMP
-	default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
-	default "8"
+	default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)
+	default "8" if SMP
 	help
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  The maximum supported value is 512 and the
diff -r cd452a3dfc5c include/linux/threads.h
--- a/include/linux/threads.h	Sun Sep 28 14:47:58 2008 +1000
+++ b/include/linux/threads.h	Sun Sep 28 15:17:24 2008 +1000
@@ -8,16 +8,10 @@
  */
 
 /*
- * Maximum supported processors that can run under SMP.  This value is
- * set via configure setting.  The maximum is equal to the size of the
- * bitmasks used on that platform, i.e. 32 or 64.  Setting this smaller
- * saves quite a bit of memory.
+ * Maximum supported processors.  Setting this smaller saves quite a
+ * bit of memory.  Use nr_cpu_ids instead of this except for bitmaps.
  */
-#ifdef CONFIG_SMP
 #define NR_CPUS		CONFIG_NR_CPUS
-#else
-#define NR_CPUS		1
-#endif
 
 #define MIN_THREADS_LEFT_FOR_ROOT 4
 
