From 48543f417f98a2df76b2b7270c992dc1f85aaa30 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 25 Mar 2006 03:08:08 -0800 Subject: [PATCH] --- yaml --- r: 23596 b: refs/heads/master c: ccb46000f4bb459777686611157ac0eac928704e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/cpumask.h | 11 ++++++----- trunk/lib/Makefile | 2 ++ trunk/lib/cpumask.c | 11 +++++++++++ 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 trunk/lib/cpumask.c diff --git a/[refs] b/[refs] index 859b9080e428..943fddae7349 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 64b91379439ff0fb007bde90eb496299c14a9b2a +refs/heads/master: ccb46000f4bb459777686611157ac0eac928704e diff --git a/trunk/include/linux/cpumask.h b/trunk/include/linux/cpumask.h index 60e56c6e03dd..9b702fd24a72 100644 --- a/trunk/include/linux/cpumask.h +++ b/trunk/include/linux/cpumask.h @@ -212,11 +212,12 @@ static inline void __cpus_shift_left(cpumask_t *dstp, bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); } -#define first_cpu(src) __first_cpu(&(src), NR_CPUS) -static inline int __first_cpu(const cpumask_t *srcp, int nbits) -{ - return min_t(int, nbits, find_first_bit(srcp->bits, nbits)); -} +#ifdef CONFIG_SMP +int __first_cpu(const cpumask_t *srcp); +#define first_cpu(src) __first_cpu(&(src)) +#else +#define first_cpu(src) 0 +#endif #define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS) static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits) diff --git a/trunk/lib/Makefile b/trunk/lib/Makefile index 648b2c1242fd..f827e3c24ec0 100644 --- a/trunk/lib/Makefile +++ b/trunk/lib/Makefile @@ -7,6 +7,8 @@ lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \ idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ sha1.o +lib-$(CONFIG_SMP) += cpumask.o + lib-y += kobject.o kref.o kobject_uevent.o klist.o obj-y += sort.o parser.o halfmd4.o iomap_copy.o diff --git a/trunk/lib/cpumask.c b/trunk/lib/cpumask.c new file mode 100644 index 000000000000..1560d97390dd --- /dev/null +++ b/trunk/lib/cpumask.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +int __first_cpu(const cpumask_t *srcp) +{ + return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS)); +} +EXPORT_SYMBOL(__first_cpu); +