Staging: lustre cleanup macros in libcfs_private.h
PATCH RESEND v2 1/1 Staging: lustre cleanup macros in libcfs_private.h
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.
---
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(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +15 -36
@@ -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) \
Signature · 1 line
2.10.2
Greg KH
maintainerQuoted 9 lines · Craig Inches
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 <[email protected]>---
Changes in v2:
- Kept statements together
- Kept operator on previous line
Why RESEND?
Quoted 73 lines
.../lustre/include/linux/libcfs/libcfs_private.h | 51 +++++++--------------- 1 file changed, 15 insertions(+), 36 deletions(-)drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +13
-31@@ -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 */
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h void cfs_array_free(void *vars); · line 211
Quoted 10 lines
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +2
-5-#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) \
I need a lustre maintainer to ack this one before I can take it. Perhaps there was a good reasaon do { } while is used here...
thanks,
greg k-h
Quoted 6 lines · Craig Inches
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 <[email protected]>
I don't think there was any particular reason for "do { } while(0)" here except force of habit.
Quoted 94 lines
---
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(-)drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +15
-36@@ -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) \Signature · 6 lines
2.10.2 _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation