From patchwork Mon Oct 20 17:03:44 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Travis X-Patchwork-Id: 5094 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 988A948355 for ; Tue, 21 Oct 2008 04:08:49 +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 BDCFEDDEF5 for ; Tue, 21 Oct 2008 04:03:25 +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 43F338F8122; Mon, 20 Oct 2008 10:03:23 -0700 (PDT) Received: by polaris-admin.engr.sgi.com (Postfix, from userid 5508) id 2D4D5517A548; Mon, 20 Oct 2008 10:03:23 -0700 (PDT) Message-Id: <20081020170323.056637000@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:44 -0700 From: Mike Travis To: Ingo Molnar , Rusty Russell Subject: [PATCH 25/35] cpumask: Deprecate CPUMASK_ALLOC etc in favor of cpumask_var_t. Content-Disposition: inline; filename=cpumask:deprecate-CPUMASK_ALLOC.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 Remove CPUMASK_ALLOC() in favor of alloc_cpumask_var(). From: Rusty Russell Signed-off-by: Rusty Russell Signed-off-by: Mike Travis --- include/linux/cpumask.h | 46 ++++++++-------------------------------------- 1 file changed, 8 insertions(+), 38 deletions(-) --- linux-2.6.28.orig/include/linux/cpumask.h +++ linux-2.6.28/include/linux/cpumask.h @@ -57,35 +57,6 @@ * CPU_MASK_NONE Initializer - no bits set * unsigned long *cpumask_bits(mask) Array of unsigned long's in mask * - * CPUMASK_ALLOC kmalloc's a structure that is a composite of many cpumask_t - * variables, and CPUMASK_PTR provides pointers to each field. - * - * The structure should be defined something like this: - * struct my_cpumasks { - * cpumask_t mask1; - * cpumask_t mask2; - * }; - * - * Usage is then: - * CPUMASK_ALLOC(my_cpumasks); - * CPUMASK_PTR(mask1, my_cpumasks); - * CPUMASK_PTR(mask2, my_cpumasks); - * - * --- DO NOT reference cpumask_t pointers until this check --- - * if (my_cpumasks == NULL) - * "kmalloc failed"... - * - * References are now pointers to the cpumask_t variables (*mask1, ...) - * - *if NR_CPUS > BITS_PER_LONG - * CPUMASK_ALLOC(m) Declares and allocates struct m *m = - * kmalloc(sizeof(*m), GFP_KERNEL) - * CPUMASK_FREE(m) Macro for kfree(m) - *else - * CPUMASK_ALLOC(m) Declares struct m _m, *m = &_m - * CPUMASK_FREE(m) Nop - *endif - * CPUMASK_PTR(v, m) Declares cpumask_t *v = &(m->v) * ------------------------------------------------------------------------ * * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing @@ -184,6 +155,14 @@ extern cpumask_t _unused_cpumask_arg_; #define first_cpu(src) cpumask_first(&(src)) #define next_cpu(n, src) cpumask_next((n), &(src)) #define any_online_cpu(mask) cpumask_any_and(&(mask), &cpu_online_map) +#if NR_CPUS > BITS_PER_LONG +#define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL) +#define CPUMASK_FREE(m) kfree(m) +#else +#define CPUMASK_ALLOC(m) struct m _m, *m = &_m +#define CPUMASK_FREE(m) +#endif +#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v) /* End deprecated region. */ #if NR_CPUS <= BITS_PER_LONG @@ -435,15 +414,6 @@ extern cpumask_t cpu_mask_all; [0] = 1UL \ } } -#if NR_CPUS > BITS_PER_LONG -#define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL) -#define CPUMASK_FREE(m) kfree(m) -#else -#define CPUMASK_ALLOC(m) struct m _m, *m = &_m -#define CPUMASK_FREE(m) -#endif -#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v) - #if NR_CPUS == 1 #define cpumask_first(src) ({ (void)(src); 0; })