From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754202AbbCaDbc (ORCPT ); Mon, 30 Mar 2015 23:31:32 -0400 Received: from ozlabs.org ([103.22.144.67]:36400 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752974AbbCaDb3 (ORCPT ); Mon, 30 Mar 2015 23:31:29 -0400 From: Rusty Russell To: Rasmus Villemoes , Andrew Morton , Tejun Heo , Rasmus Villemoes Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] linux/cpumask.h: add typechecking to cpumask_test_cpu In-Reply-To: <1427759298-28155-1-git-send-email-linux@rasmusvillemoes.dk> References: <1427759298-28155-1-git-send-email-linux@rasmusvillemoes.dk> User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Tue, 31 Mar 2015 13:55:10 +1030 Message-ID: <87siclonl5.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rasmus Villemoes writes: > The Subtlety (1) referred to vanished with 6ba2ef7baac2 ("cpumask: > Move deprecated functions to end of header."). That used to mention > some suboptimal code generation by a, by now, rather ancient gcc. With > gcc 4.7, I don't see any change in the generated code by making it a > static inline, so let's add type checking and get rid of the ghost > reference. > > Signed-off-by: Rasmus Villemoes Thanks, applied. Cheers, Rusty. > --- > include/linux/cpumask.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h > index 086549a665e2..972c30e0714e 100644 > --- a/include/linux/cpumask.h > +++ b/include/linux/cpumask.h > @@ -289,11 +289,11 @@ static inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp) > * @cpumask: the cpumask pointer > * > * Returns 1 if @cpu is set in @cpumask, else returns 0 > - * > - * No static inline type checking - see Subtlety (1) above. > */ > -#define cpumask_test_cpu(cpu, cpumask) \ > - test_bit(cpumask_check(cpu), cpumask_bits((cpumask))) > +static inline int cpumask_test_cpu(int cpu, const struct cpumask *cpumask) > +{ > + return test_bit(cpumask_check(cpu), cpumask_bits((cpumask))); > +} > > /** > * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask > -- > 2.1.3