Merge tag 'v4.1-rockchip-socfixes1' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / lib / cpumask.c
index b6513a9f2892042a8a49a5bc872c0ca33990e2d8..830dd5dec40f1697b2bf2e40a294e05284ded89c 100644 (file)
@@ -5,27 +5,6 @@
 #include <linux/export.h>
 #include <linux/bootmem.h>
 
-int __first_cpu(const cpumask_t *srcp)
-{
-       return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
-}
-EXPORT_SYMBOL(__first_cpu);
-
-int __next_cpu(int n, const cpumask_t *srcp)
-{
-       return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1));
-}
-EXPORT_SYMBOL(__next_cpu);
-
-#if NR_CPUS > 64
-int __next_cpu_nr(int n, const cpumask_t *srcp)
-{
-       return min_t(int, nr_cpu_ids,
-                               find_next_bit(srcp->bits, nr_cpu_ids, n+1));
-}
-EXPORT_SYMBOL(__next_cpu_nr);
-#endif
-
 /**
  * cpumask_next_and - get the next cpu in *src1p & *src2p
  * @n: the cpu prior to the place to search (ie. return will be > @n)
@@ -37,10 +16,11 @@ EXPORT_SYMBOL(__next_cpu_nr);
 int cpumask_next_and(int n, const struct cpumask *src1p,
                     const struct cpumask *src2p)
 {
-       while ((n = cpumask_next(n, src1p)) < nr_cpu_ids)
-               if (cpumask_test_cpu(n, src2p))
-                       break;
-       return n;
+       struct cpumask tmp;
+
+       if (cpumask_and(&tmp, src1p, src2p))
+               return cpumask_next(n, &tmp);
+       return nr_cpu_ids;
 }
 EXPORT_SYMBOL(cpumask_next_and);
 
@@ -89,13 +69,6 @@ bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
                dump_stack();
        }
 #endif
-       /* FIXME: Bandaid to save us from old primitives which go to NR_CPUS. */
-       if (*mask) {
-               unsigned char *ptr = (unsigned char *)cpumask_bits(*mask);
-               unsigned int tail;
-               tail = BITS_TO_LONGS(NR_CPUS - nr_cpumask_bits) * sizeof(long);
-               memset(ptr + cpumask_size() - tail, 0, tail);
-       }
 
        return *mask != NULL;
 }