Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756194AbdDRJsS convert rfc822-to-8bit (ORCPT ); Tue, 18 Apr 2017 05:48:18 -0400 Received: from mga14.intel.com ([192.55.52.115]:14566 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755515AbdDRJrs (ORCPT ); Tue, 18 Apr 2017 05:47:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,218,1488873600"; d="scan'208";a="75507020" From: "Dilger, Andreas" To: Craig Inches CC: "Drokin, Oleg" , "jsimmons@infradead.org" , "gregkh@linuxfoundation.org" , "Hammond, John" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" , "lustre-devel@lists.lustre.org" Subject: Re: [lustre-devel] [PATCH RESEND v2] Staging: lustre cleanup macros in libcfs_private.h Thread-Topic: [lustre-devel] [PATCH RESEND v2] Staging: lustre cleanup macros in libcfs_private.h Thread-Index: AQHStDfP6oTxU+pHBEGU8ldBeKZnL6HLXo+A Date: Tue, 18 Apr 2017 09:47:46 +0000 Message-ID: <85E9E90F-59AA-4755-8CAE-F294B83DD0E9@intel.com> References: <20170413092441.GA22444@starbase.xayto.local> In-Reply-To: <20170413092441.GA22444@starbase.xayto.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.252.199.57] Content-Type: text/plain; charset="us-ascii" Content-ID: <067FE0A47ECEB94586B4AA161E19BDE5@intel.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3934 Lines: 119 On Apr 13, 2017, at 03:24, Craig Inches wrote: > > This resolves a checkpatch warning that "Single statement macros should > not use a do {} while (0) loop" by removing the loop and adjusting line > length accordingly. > > Signed-off-by: Craig Inches I don't think there was any particular reason for "do { } while(0)" here except force of habit. Reviewed-by: Andreas Dilger > --- > Changes in v2: > - Kept statements together > - Kept operator on previous line > > .../lustre/include/linux/libcfs/libcfs_private.h | 51 +++++++--------------- > 1 file changed, 15 insertions(+), 36 deletions(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h > index 2dae857..e774c75 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h > @@ -87,12 +87,9 @@ do { \ > #define LIBCFS_VMALLOC_SIZE (2 << PAGE_SHIFT) /* 2 pages */ > #endif > > -#define LIBCFS_ALLOC_PRE(size, mask) \ > -do { \ > - LASSERT(!in_interrupt() || \ > - ((size) <= LIBCFS_VMALLOC_SIZE && \ > - !gfpflags_allow_blocking(mask))); \ > -} while (0) > +#define LIBCFS_ALLOC_PRE(size, mask) \ > + LASSERT(!in_interrupt() || ((size) <= LIBCFS_VMALLOC_SIZE && \ > + !gfpflags_allow_blocking(mask))) > > #define LIBCFS_ALLOC_POST(ptr, size) \ > do { \ > @@ -187,46 +184,28 @@ void cfs_array_free(void *vars); > #if LASSERT_ATOMIC_ENABLED > > /** assert value of @a is equal to @v */ > -#define LASSERT_ATOMIC_EQ(a, v) \ > -do { \ > - LASSERTF(atomic_read(a) == v, \ > - "value: %d\n", atomic_read((a))); \ > -} while (0) > +#define LASSERT_ATOMIC_EQ(a, v) \ > + LASSERTF(atomic_read(a) == v, "value: %d\n", atomic_read((a))) > > /** assert value of @a is unequal to @v */ > -#define LASSERT_ATOMIC_NE(a, v) \ > -do { \ > - LASSERTF(atomic_read(a) != v, \ > - "value: %d\n", atomic_read((a))); \ > -} while (0) > +#define LASSERT_ATOMIC_NE(a, v) \ > + LASSERTF(atomic_read(a) != v, "value: %d\n", atomic_read((a))) > > /** assert value of @a is little than @v */ > -#define LASSERT_ATOMIC_LT(a, v) \ > -do { \ > - LASSERTF(atomic_read(a) < v, \ > - "value: %d\n", atomic_read((a))); \ > -} while (0) > +#define LASSERT_ATOMIC_LT(a, v) \ > + LASSERTF(atomic_read(a) < v, "value: %d\n", atomic_read((a))) > > /** assert value of @a is little/equal to @v */ > -#define LASSERT_ATOMIC_LE(a, v) \ > -do { \ > - LASSERTF(atomic_read(a) <= v, \ > - "value: %d\n", atomic_read((a))); \ > -} while (0) > +#define LASSERT_ATOMIC_LE(a, v) \ > + LASSERTF(atomic_read(a) <= v, "value: %d\n", atomic_read((a))) > > /** assert value of @a is great than @v */ > -#define LASSERT_ATOMIC_GT(a, v) \ > -do { \ > - LASSERTF(atomic_read(a) > v, \ > - "value: %d\n", atomic_read((a))); \ > -} while (0) > +#define LASSERT_ATOMIC_GT(a, v) \ > + LASSERTF(atomic_read(a) > v, "value: %d\n", atomic_read((a))) > > /** assert value of @a is great/equal to @v */ > -#define LASSERT_ATOMIC_GE(a, v) \ > -do { \ > - LASSERTF(atomic_read(a) >= v, \ > - "value: %d\n", atomic_read((a))); \ > -} while (0) > +#define LASSERT_ATOMIC_GE(a, v) \ > + LASSERTF(atomic_read(a) >= v, "value: %d\n", atomic_read((a))) > > /** assert value of @a is great than @v1 and little than @v2 */ > #define LASSERT_ATOMIC_GT_LT(a, v1, v2) \ > -- > 2.10.2 > > _______________________________________________ > lustre-devel mailing list > lustre-devel@lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org Cheers, Andreas -- Andreas Dilger Lustre Principal Architect Intel Corporation