From patchwork Mon Oct 20 17:03:49 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Travis X-Patchwork-Id: 5108 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 91238DF164 for ; Tue, 21 Oct 2008 04:14:16 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from relay.sgi.com (relay1.sgi.com [192.48.171.29]) by ozlabs.org (Postfix) with ESMTP id 84C06DDF29 for ; Tue, 21 Oct 2008 04:03:27 +1100 (EST) Received: from polaris-admin.engr.sgi.com (polaris-admin.engr.sgi.com [192.102.97.111]) by relay1.corp.sgi.com (Postfix) with ESMTP id D3F308F8125; Mon, 20 Oct 2008 10:03:23 -0700 (PDT) Received: by polaris-admin.engr.sgi.com (Postfix, from userid 5508) id D24A5517A555; Mon, 20 Oct 2008 10:03:23 -0700 (PDT) Message-Id: <20081020170323.736089000@polaris-admin.engr.sgi.com> References: <20081020170319.539427000@polaris-admin.engr.sgi.com> User-Agent: quilt/0.46-1 Date: Mon, 20 Oct 2008 10:03:49 -0700 From: Mike Travis To: Ingo Molnar , Rusty Russell Subject: [PATCH 30/35] cpumask: CONFIG_BITS_ALL, CONFIG_BITS_NONE and CONFIG_BITS_CPU0 Content-Disposition: inline; filename=cpumask:CPU_BITS_ALL-and-CPU_BITS_NONE.patch Cc: davej@codemonkey.org.uk, Jeremy Fitzhardinge , Jes Sorensen , IA64 , S390 , peterz@infradead.org, Jack Steiner , linux-kernel@vger.kernel.org, Eric Dumazet , PowerPC , Andi Kleen , Thomas Gleixner , Yinghai Lu , "H. Peter Anvin" , SPARC , Andrew Morton , David Miller X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Since we're now preferring raw bitmaps for (eventually rare) static cpumasks, we replace CPU_MASK_X with CPU_BITS_X. From: Rusty Russell Signed-off-by: Rusty Russell Signed-off-by: Mike Travis --- include/linux/cpumask.h | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) --- linux-2.6.28.orig/include/linux/cpumask.h +++ linux-2.6.28/include/linux/cpumask.h @@ -53,8 +53,9 @@ * * size_t cpumask_size() Length of cpumask in bytes. * const struct cpumask *cpumask_of(cpu) Return cpumask with bit 'cpu' set - * CPU_MASK_ALL Initializer - all bits set - * CPU_MASK_NONE Initializer - no bits set + * CPU_BITS_ALL Initializer - all bits set + * CPU_BITS_NONE Initializer - no bits set + * CPU_BITS_CPU0 Initializer - first bit set * unsigned long *cpumask_bits(mask) Array of unsigned long's in mask * * struct cpumask *to_cpumask(const unsigned long[]) @@ -116,6 +117,9 @@ struct cpumask typedef struct cpumask cpumask_t; extern cpumask_t _unused_cpumask_arg_; +#define CPU_MASK_ALL ((cpumask_t){ CPU_BITS_ALL }) +#define CPU_MASK_NONE ((cpumask_t){ CPU_BITS_NONE }) +#define CPU_MASK_CPU0 ((cpumask_t){ CPU_BITS_CPU0 }) #define cpu_set(cpu, dst) cpumask_set_cpu((cpu), &(dst)) #define cpu_clear(cpu, dst) cpumask_clear_cpu((cpu), &(dst)) #define cpu_test_and_set(cpu, mask) cpumask_test_and_set_cpu((cpu), &(mask)) @@ -397,20 +401,20 @@ static inline const struct cpumask *cpum #if NR_CPUS <= BITS_PER_LONG -#define CPU_MASK_ALL \ -(cpumask_t) { { \ - [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ -} } +#define CPU_BITS_ALL \ +{ \ + [BITS_TO_LONGS(CONFIG_NR_CPUS)-1] = CPU_MASK_LAST_WORD \ +} #define CPU_MASK_ALL_PTR (&CPU_MASK_ALL) #else -#define CPU_MASK_ALL \ -(cpumask_t) { { \ - [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \ - [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ -} } +#define CPU_BITS_ALL \ +{ \ + [0 ... BITS_TO_LONGS(CONFIG_NR_CPUS)-2] = ~0UL, \ + [BITS_TO_LONGS(CONFIG_NR_CPUS)-1] = CPU_MASK_LAST_WORD \ +} /* cpu_mask_all is in init/main.c */ extern cpumask_t cpu_mask_all; @@ -418,15 +422,15 @@ extern cpumask_t cpu_mask_all; #endif -#define CPU_MASK_NONE \ -(cpumask_t) { { \ - [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \ -} } - -#define CPU_MASK_CPU0 \ -(cpumask_t) { { \ - [0] = 1UL \ -} } +#define CPU_BITS_NONE \ +{ \ + [0 ... BITS_TO_LONGS(CONFIG_NR_CPUS)-1] = 0UL \ +} + +#define CPU_BITS_CPU0 \ +{ \ + [0] = 1UL \ +} #if NR_CPUS == 1