cpumask: allow disabling obsolete cpumask functions on x86

It currently depends on CONFIG_BROKEN; change to CONFIG_X86 (the
only platform which offers CPUMASK_OFFSTACK, so the only place
where it's really important).

We also complete it: it removes cpu_*_map, and shouldn't refer to
the deprected CPU_MASK_LAST_WORD.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 include/linux/cpumask.h |    6 ++++--
 kernel/cpu.c            |    2 ++
 lib/Kconfig             |    4 +++-
 lib/cpumask.c           |    2 ++
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -481,6 +481,7 @@ extern const struct cpumask *const cpu_p
 extern const struct cpumask *const cpu_present_mask;
 extern const struct cpumask *const cpu_active_mask;
 
+#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
 /* Deprecated: use cpu_*_mask and set_cpu_*(). */
 #define cpu_possible_map	(*_cpu_possible_mask_nonconst)
 #define cpu_online_map		(*_cpu_online_mask_nonconst)
@@ -490,6 +491,7 @@ extern struct cpumask *_cpu_online_mask_
 extern struct cpumask *_cpu_online_mask_nonconst;
 extern struct cpumask *_cpu_present_mask_nonconst;
 extern struct cpumask *_cpu_active_mask_nonconst;
+#endif
 
 #if NR_CPUS > 1
 #define num_online_cpus()	cpumask_weight(cpu_online_mask)
@@ -518,7 +520,7 @@ extern struct cpumask *_cpu_active_mask_
 #if NR_CPUS <= BITS_PER_LONG
 #define CPU_BITS_ALL						\
 {								\
-	[BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD	\
+	[BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS)	\
 }
 
 #else /* NR_CPUS > BITS_PER_LONG */
@@ -526,7 +528,7 @@ extern struct cpumask *_cpu_active_mask_
 #define CPU_BITS_ALL						\
 {								\
 	[0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL,		\
-	[BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD		\
+	[BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS)	\
 }
 #endif /* NR_CPUS > BITS_PER_LONG */
 
diff --git a/kernel/cpu.c b/kernel/cpu.c
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -561,6 +561,7 @@ void init_cpu_online(const struct cpumas
 	cpumask_copy(to_cpumask(cpu_online_bits), src);
 }
 
+#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
 /* Deprecated accessors. */
 struct cpumask *_cpu_possible_mask_nonconst = to_cpumask(cpu_possible_bits);
 EXPORT_SYMBOL(_cpu_possible_mask_nonconst);
@@ -570,3 +571,4 @@ EXPORT_SYMBOL(_cpu_present_mask_nonconst
 EXPORT_SYMBOL(_cpu_present_mask_nonconst);
 struct cpumask *_cpu_active_mask_nonconst = to_cpumask(cpu_active_bits);
 EXPORT_SYMBOL(_cpu_active_mask_nonconst);
+#endif
diff --git a/lib/Kconfig b/lib/Kconfig
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -166,7 +166,9 @@ config CPUMASK_OFFSTACK
 
 config DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
        bool "Disable obsolete cpumask functions" if DEBUG_PER_CPU_MAPS
-       depends on EXPERIMENTAL && BROKEN
+       depends on EXPERIMENTAL && X86
+       help
+	 Only x86 has been cleaned of obsolescent cpumask functions.
 
 #
 # Netlink attribute parsing support is select'ed if needed
diff --git a/lib/cpumask.c b/lib/cpumask.c
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -4,6 +4,7 @@
 #include <linux/module.h>
 #include <linux/bootmem.h>
 
+#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
 int __first_cpu(const cpumask_t *srcp)
 {
 	return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
@@ -36,6 +37,7 @@ int __any_online_cpu(const cpumask_t *ma
 	return cpu;
 }
 EXPORT_SYMBOL(__any_online_cpu);
+#endif /* CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
 
 /**
  * cpumask_next_and - get the next cpu in *src1p & *src2p
