Skip to contentSkip to conversation

staging: lustre: fix macro definitions warnings

PATCH In review Aastha Gupta 2 participants 11 messages Sep 14, 2017 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: lustre: fix macro definitions warnings

This patchset fixes macro definition warnings by checkpatch.pl.

---------------------------------------------------------------------

Aastha Gupta (3):
staging: lustre: enclose multi line macros in do-while block
staging: lustre: fix macro definitions warnings
staging: lustre: enclose multi line macro in do-while block

 drivers/staging/lustre/lustre/include/lu_object.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 staging: lustre: enclose multi line macros in do-while block

This patch fixes the checkpatch.pl warning:

macros with multiple lines should be enclosed in do-while block

---
 drivers/staging/lustre/lustre/include/lu_object.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/lu_object.h +3 -1
index a3c0481..4e4bcf4 100644
@@ -1151,8 +1151,10 @@ struct lu_context_key {
 	struct __##mod##__dummy_fini {; } /* semicolon catcher */
 
 #define LU_KEY_INIT_FINI(mod, type)   \
+do {					\
 	LU_KEY_INIT(mod, type);	\
-	LU_KEY_FINI(mod, type)
+	LU_KEY_FINI(mod, type); \
+} while (0)
 
 #define LU_CONTEXT_KEY_DEFINE(mod, tags)		\
 	struct lu_context_key mod##_thread_key = {      \
Signature · 1 line
2.7.4
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/3] staging: lustre: enclose multi line macros in do-while block

Patches 1 and 3 end up with the same subject line. They do basically the same thing in the same file, so they should be merged.

julia

Quoted 35 lines · Aastha Gupta

This patch fixes the checkpatch.pl warning:

macros with multiple lines should be enclosed in do-while block

---
 drivers/staging/lustre/lustre/include/lu_object.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/lu_object.h +3 -2
index a3c0481..4e4bcf4 100644
@@ -1151,8 +1151,10 @@ struct lu_context_key {
 	struct __##mod##__dummy_fini {; } /* semicolon catcher */
 
 #define LU_KEY_INIT_FINI(mod, type)   \
+do {					\
 	LU_KEY_INIT(mod, type);	\
-	LU_KEY_FINI(mod, type)
+	LU_KEY_FINI(mod, type); \
+} while (0)
 
 #define LU_CONTEXT_KEY_DEFINE(mod, tags)		\
 	struct lu_context_key mod##_thread_key = {      \
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/93cfc5fc6f59b33d9aca6dd3b33f86150e1f5abb.1505414917.git.aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

PATCH 2/3 staging: lustre: fix macro definitions warnings

In reply to Aastha Gupta

This patch fixes checkpatch.pl warning for macro definitions.

1. single line macro definitions should not be in do-while block.
2. macros with complex values should be enclosed in parentheses.

---
 drivers/staging/lustre/lustre/include/lu_object.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +2 -4
index 4e4bcf4..abbb4d6 100644
@@ -1163,10 +1163,8 @@ do {					\
 		.lct_fini = mod##_key_fini	      \
 	}
 
-#define LU_CONTEXT_KEY_INIT(key)			\
-do {						    \
-	(key)->lct_owner = THIS_MODULE;		 \
-} while (0)
+#define LU_CONTEXT_KEY_INIT(key) ((key)->lct_owner = THIS_MODULE)
+
 
 int lu_context_key_register(struct lu_context_key *key);
 void lu_context_key_degister(struct lu_context_key *key);
Signature · 1 line
2.7.4
#4 lore raw
Quoted 4 lines · Aastha Gupta

This patch fixes checkpatch.pl warning for macro definitions.

1. single line macro definitions should not be in do-while block.
2. macros with complex values should be enclosed in parentheses.

The second warning is not addressed in the patch.

Quoted 11 lines
---
 drivers/staging/lustre/lustre/include/lu_object.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +0 -0
index 4e4bcf4..abbb4d6 100644

drivers/staging/lustre/lustre/include/lu_object.h do { \ · line 1167

Quoted 9 lines
drivers/staging/lustre/lustre/include/lu_object.h +2 -4
@@ -1163,10 +1163,8 @@ do {					\
 		.lct_fini = mod##_key_fini	      \
 	}
 
-#define LU_CONTEXT_KEY_INIT(key)			\
-do {						    \
-	(key)->lct_owner = THIS_MODULE;		 \
-} while (0)
+#define LU_CONTEXT_KEY_INIT(key) ((key)->lct_owner = THIS_MODULE)
+

No need to add a blank line.

julia

Quoted 13 lines
drivers/staging/lustre/lustre/include/lu_object.h +0 -1
 int lu_context_key_register(struct lu_context_key *key);
 void lu_context_key_degister(struct lu_context_key *key);
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/ba81893e8d74ca5367f14caa8b4b221df25efdff.1505414917.git.aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#5 lore raw
In reply to Aastha Gupta
Quoted 4 lines · Aastha Gupta

This patch fixes checkpatch.pl warning for macro definitions.

1. single line macro definitions should not be in do-while block.
2. macros with complex values should be enclosed in parentheses.

This one could be merged with the other two. The part that should have been put into a separate patch was the removal of the two macros that are never used.

julia

Quoted 33 lines
---
 drivers/staging/lustre/lustre/include/lu_object.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +2 -5
index 4e4bcf4..abbb4d6 100644
@@ -1163,10 +1163,8 @@ do {					\
 		.lct_fini = mod##_key_fini	      \
 	}
 
-#define LU_CONTEXT_KEY_INIT(key)			\
-do {						    \
-	(key)->lct_owner = THIS_MODULE;		 \
-} while (0)
+#define LU_CONTEXT_KEY_INIT(key) ((key)->lct_owner = THIS_MODULE)
+
 
 int lu_context_key_register(struct lu_context_key *key);
 void lu_context_key_degister(struct lu_context_key *key);
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/ba81893e8d74ca5367f14caa8b4b221df25efdff.1505414917.git.aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw

cover staging: lustre: fix macro definitions

This patch:
1. fixes the checkpatch.pl macro warnings.
2. removes macros with no uses

---------------------------------------------------------------------

Aastha Gupta (2):
staging: lustre: fix macro definitions warnings
staging: lustre: drop macro that has no uses

 drivers/staging/lustre/lustre/include/lu_object.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.7.4
#7 lore raw

PATCH 1/2 staging: lustre: fix macro definitions warnings

This patch fixes the checkpatch.pl warnings related to macro definitions.
1. macros with complex values should be enclosed in parentheses.
2. macros with multiple lines should be enclosed in do-while block.

---
 drivers/staging/lustre/lustre/include/lu_object.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +8 -6
index a3c0481..c8d5e0b 100644
@@ -1151,8 +1151,10 @@ struct lu_context_key {
 	struct __##mod##__dummy_fini {; } /* semicolon catcher */
 
 #define LU_KEY_INIT_FINI(mod, type)   \
+do {					\
 	LU_KEY_INIT(mod, type);	\
-	LU_KEY_FINI(mod, type)
+	LU_KEY_FINI(mod, type); \
+} while (0)
 
 #define LU_CONTEXT_KEY_DEFINE(mod, tags)		\
 	struct lu_context_key mod##_thread_key = {      \
@@ -1161,10 +1163,8 @@ struct lu_context_key {
 		.lct_fini = mod##_key_fini	      \
 	}
 
-#define LU_CONTEXT_KEY_INIT(key)			\
-do {						    \
-	(key)->lct_owner = THIS_MODULE;		 \
-} while (0)
+#define LU_CONTEXT_KEY_INIT(key) ((key)->lct_owner = THIS_MODULE)
+
 
 int lu_context_key_register(struct lu_context_key *key);
 void lu_context_key_degister(struct lu_context_key *key);
@@ -1223,10 +1223,12 @@ void lu_context_key_revive(struct lu_context_key *key);
 	struct __##mod##_dummy_type_stop {; }
 
 #define LU_TYPE_INIT_FINI(mod, ...)	     \
+do {						\
 	LU_TYPE_INIT(mod, __VA_ARGS__);	 \
 	LU_TYPE_FINI(mod, __VA_ARGS__);	 \
 	LU_TYPE_START(mod, __VA_ARGS__);	\
-	LU_TYPE_STOP(mod, __VA_ARGS__)
+	LU_TYPE_STOP(mod, __VA_ARGS__);		\
+} while (0)
 
 int lu_context_init(struct lu_context *ctx, __u32 tags);
 void lu_context_fini(struct lu_context *ctx);
Signature · 1 line
2.7.4
#8 lore raw
Quoted 3 lines · Aastha Gupta

This patch fixes the checkpatch.pl warnings related to macro definitions.
1. macros with complex values should be enclosed in parentheses.

This one is not represented.

Quoted 1 line

2. macros with multiple lines should be enclosed in do-while block.

This one does not cover all of the changes that are made.

julia

Quoted 58 lines
---
 drivers/staging/lustre/lustre/include/lu_object.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +8 -7
index a3c0481..c8d5e0b 100644
@@ -1151,8 +1151,10 @@ struct lu_context_key {
 	struct __##mod##__dummy_fini {; } /* semicolon catcher */
 
 #define LU_KEY_INIT_FINI(mod, type)   \
+do {					\
 	LU_KEY_INIT(mod, type);	\
-	LU_KEY_FINI(mod, type)
+	LU_KEY_FINI(mod, type); \
+} while (0)
 
 #define LU_CONTEXT_KEY_DEFINE(mod, tags)		\
 	struct lu_context_key mod##_thread_key = {      \
@@ -1161,10 +1163,8 @@ struct lu_context_key {
 		.lct_fini = mod##_key_fini	      \
 	}
 
-#define LU_CONTEXT_KEY_INIT(key)			\
-do {						    \
-	(key)->lct_owner = THIS_MODULE;		 \
-} while (0)
+#define LU_CONTEXT_KEY_INIT(key) ((key)->lct_owner = THIS_MODULE)
+
 
 int lu_context_key_register(struct lu_context_key *key);
 void lu_context_key_degister(struct lu_context_key *key);
@@ -1223,10 +1223,12 @@ void lu_context_key_revive(struct lu_context_key *key);
 	struct __##mod##_dummy_type_stop {; }
 
 #define LU_TYPE_INIT_FINI(mod, ...)	     \
+do {						\
 	LU_TYPE_INIT(mod, __VA_ARGS__);	 \
 	LU_TYPE_FINI(mod, __VA_ARGS__);	 \
 	LU_TYPE_START(mod, __VA_ARGS__);	\
-	LU_TYPE_STOP(mod, __VA_ARGS__)
+	LU_TYPE_STOP(mod, __VA_ARGS__);		\
+} while (0)
 
 int lu_context_init(struct lu_context *ctx, __u32 tags);
 void lu_context_fini(struct lu_context *ctx);
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/b2fc843770e35e8fc84e1c4acbdecee869633560.1505421269.git.aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#9 lore raw

PATCH 2/2 staging: lustre: drop macro definitions with no users

In reply to Aastha Gupta

This patch removes DLUBUF and PLUBUF macro, both of which have no users.

---

This patch is as instructed by Andreas Dilger in one of the previous mails.

 drivers/staging/lustre/lustre/include/lu_object.h | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +0 -2
index c8d5e0b..d5ecd58 100644
@@ -1305,8 +1305,6 @@ struct lu_buf {
 	size_t	lb_len;
 };
 
-#define DLUBUF "(%p %zu)"
-#define PLUBUF(buf) (buf)->lb_buf, (buf)->lb_len
 /**
  * One-time initializers, called at obdclass module initialization, not
  * exported.
Signature · 1 line
2.7.4
#10 lore raw

PATCH 3/3 staging: lustre: enclose multi line macro in do-while block

In reply to Aastha Gupta

This patch fixes the checkpatch.pl warning:

macros with multiple lines should be enclosed in do-while block.

---
 drivers/staging/lustre/lustre/include/lu_object.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/lu_object.h +3 -1
index abbb4d6..c8d5e0b 100644
@@ -1223,10 +1223,12 @@ void lu_context_key_revive(struct lu_context_key *key);
 	struct __##mod##_dummy_type_stop {; }
 
 #define LU_TYPE_INIT_FINI(mod, ...)	     \
+do {						\
 	LU_TYPE_INIT(mod, __VA_ARGS__);	 \
 	LU_TYPE_FINI(mod, __VA_ARGS__);	 \
 	LU_TYPE_START(mod, __VA_ARGS__);	\
-	LU_TYPE_STOP(mod, __VA_ARGS__)
+	LU_TYPE_STOP(mod, __VA_ARGS__);		\
+} while (0)
 
 int lu_context_init(struct lu_context *ctx, __u32 tags);
 void lu_context_fini(struct lu_context *ctx);
Signature · 1 line
2.7.4