Skip to contentSkip to conversation

Fix trailing whitespace in trace.h

PATCH In review YAMANE Toshiaki 3 participants 10 messages Oct 2, 2012 – Oct 3, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Fix trailing whitespace in trace.h

fixed below checkpatch error.

-ERROR: trailing whitespace

---
 drivers/staging/rts_pstor/trace.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rts_pstor/trace.h +1 -1
index cf60a1b..740999c 100644
@@ -39,7 +39,7 @@ static inline char *filename(char *path)
 	while (*ptr != '\0') {
 		if ((*ptr == '\\') || (*ptr == '/'))
 			path = ptr + 1;
-		
+
 		ptr++;
 	}
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/3 Add parenthesis to macros with complex values in trace.h

fixed some checkpatch below error.
-ERROR: Macros with complex values should be enclosed in parenthesis

---
 drivers/staging/rts_pstor/trace.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts_pstor/trace.h +2 -2
index 740999c..a34493c 100644
@@ -78,8 +78,8 @@ do {													\
 	goto label; 											\
 } while (0)
 #else
-#define TRACE_RET(chip, ret)	return ret
-#define TRACE_GOTO(chip, label)	goto label
+#define TRACE_RET(chip, ret)	return(ret)
+#define TRACE_GOTO(chip, label)	goto(label)
 #endif
 
 #ifdef CONFIG_RTS_PSTOR_DEBUG
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 2/3] Add parenthesis to macros with complex values in trace.h

Quoted 13 lines · YAMANE Toshiaki

fixed some checkpatch below error.
-ERROR: Macros with complex values should be enclosed in parenthesis

---
 drivers/staging/rts_pstor/trace.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts_pstor/trace.h +0 -0
index 740999c..a34493c 100644

drivers/staging/rts_pstor/trace.h do { \ · line 83

Quoted 8 lines
drivers/staging/rts_pstor/trace.h +2 -2
@@ -78,8 +78,8 @@ do {													\
 	goto label; 											\
 } while (0)
 #else
-#define TRACE_RET(chip, ret)	return ret
-#define TRACE_GOTO(chip, label)	goto label
+#define TRACE_RET(chip, ret)	return(ret)
+#define TRACE_GOTO(chip, label)	goto(label)
 #endif

In this specific case I think checkpatch.pl wants more than needed.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw

Re: [PATCH 2/3] Add parenthesis to macros with complex values in trace.h

In reply to YAMANE Toshiaki
Quoted 13 lines · YAMANE Toshiaki

fixed some checkpatch below error.
-ERROR: Macros with complex values should be enclosed in parenthesis

---
 drivers/staging/rts_pstor/trace.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts_pstor/trace.h +0 -0
index 740999c..a34493c 100644

drivers/staging/rts_pstor/trace.h do { \ · line 82

Quoted 7 lines
drivers/staging/rts_pstor/trace.h +2 -2
@@ -78,8 +78,8 @@ do {													\
 	goto label; 											\
 } while (0)
 #else
-#define TRACE_RET(chip, ret)	return ret
-#define TRACE_GOTO(chip, label)	goto label
+#define TRACE_RET(chip, ret)	return(ret)
+#define TRACE_GOTO(chip, label)	goto(label)

This will cause a compile error.

There is no need to do this, checkpatch.pl is wrong here.

regards,
dan carpenter

#4 lore raw

Re: [PATCH 2/3] Add parenthesis to macros with complex values in trace.h

Quoted 24 lines · Dan Carpenter
Quoted 13 lines · YAMANE Toshiaki

fixed some checkpatch below error.
-ERROR: Macros with complex values should be enclosed in parenthesis

---
 drivers/staging/rts_pstor/trace.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts_pstor/trace.h +0 -0
index 740999c..a34493c 100644

drivers/staging/rts_pstor/trace.h do { \ · line 82

Quoted 7 lines
drivers/staging/rts_pstor/trace.h +2 -2
@@ -78,8 +78,8 @@ do {                                                                                                        \
      goto label;                                                                                     \
 } while (0)
 #else
-#define TRACE_RET(chip, ret) return ret
-#define TRACE_GOTO(chip, label)      goto label
+#define TRACE_RET(chip, ret) return(ret)
+#define TRACE_GOTO(chip, label)      goto(label)

This will cause a compile error.

Quoted 1 line

There is no need to do this, checkpatch.pl is wrong here.

I will destroy this patch series.
thanks.

YAMANE Toshiaki

#5 lore raw

PATCH 3/3 Fix line over 80 character issue and space before tabs issue in trace.h

In reply to YAMANE Toshiaki

fixed some checkpatch warnings.

-WARNING: line over 80 characters
-WARNING: please, no space before tabs

---
 drivers/staging/rts_pstor/trace.h |   62 ++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 28 deletions(-)
drivers/staging/rts_pstor/trace.h +34 -28
index a34493c..fdc48cc 100644
@@ -46,36 +46,42 @@ static inline char *filename(char *path)
 	return path;
 }
 
-#define TRACE_RET(chip, ret)   										\
-do {													\
-	char *_file = filename(__FILE__);								\
-	RTSX_DEBUGP("[%s][%s]:[%d]\n", _file, __func__, __LINE__);					\
-	(chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__);					\
-	strncpy((chip)->trace_msg[(chip)->msg_idx].func, __func__, MSG_FUNC_LEN-1);			\
-	strncpy((chip)->trace_msg[(chip)->msg_idx].file, _file, MSG_FILE_LEN-1); 			\
-	get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf, TIME_VAL_LEN);			\
-	(chip)->trace_msg[(chip)->msg_idx].valid = 1;							\
-	(chip)->msg_idx++; 										\
-	if ((chip)->msg_idx >= TRACE_ITEM_CNT) { 							\
-		(chip)->msg_idx = 0;									\
-	}												\
-	return ret; 											\
+#define TRACE_RET(chip, ret) \
+do { \
+	char *_file = filename(__FILE__); \
+	RTSX_DEBUGP("[%s][%s]:[%d]\n", _file, __func__, __LINE__); \
+	(chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \
+	strncpy((chip)->trace_msg[(chip)->msg_idx].func, \
+		__func__, MSG_FUNC_LEN-1); \
+	strncpy((chip)->trace_msg[(chip)->msg_idx].file, \
+		_file, MSG_FILE_LEN-1); \
+	get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf, \
+			 TIME_VAL_LEN); \
+	(chip)->trace_msg[(chip)->msg_idx].valid = 1; \
+	(chip)->msg_idx++; \
+	if ((chip)->msg_idx >= TRACE_ITEM_CNT) { \
+		(chip)->msg_idx = 0; \
+	} \
+	return ret; \
 } while (0)
 
-#define TRACE_GOTO(chip, label)   									\
-do {													\
-	char *_file = filename(__FILE__);								\
-	RTSX_DEBUGP("[%s][%s]:[%d]\n", _file, __func__, __LINE__);					\
-	(chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__);					\
-	strncpy((chip)->trace_msg[(chip)->msg_idx].func, __func__, MSG_FUNC_LEN-1);			\
-	strncpy((chip)->trace_msg[(chip)->msg_idx].file, _file, MSG_FILE_LEN-1); 			\
-	get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf, TIME_VAL_LEN);			\
-	(chip)->trace_msg[(chip)->msg_idx].valid = 1;							\
-	(chip)->msg_idx++; 										\
-	if ((chip)->msg_idx >= TRACE_ITEM_CNT) { 							\
-		(chip)->msg_idx = 0;									\
-	}												\
-	goto label; 											\
+#define TRACE_GOTO(chip, label) \
+do { \
+	char *_file = filename(__FILE__); \
+	RTSX_DEBUGP("[%s][%s]:[%d]\n", _file, __func__, __LINE__); \
+	(chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \
+	strncpy((chip)->trace_msg[(chip)->msg_idx].func, \
+		__func__, MSG_FUNC_LEN-1); \
+	strncpy((chip)->trace_msg[(chip)->msg_idx].file, \
+		_file, MSG_FILE_LEN-1); \
+	get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf, \
+			 TIME_VAL_LEN); \
+	(chip)->trace_msg[(chip)->msg_idx].valid = 1; \
+	(chip)->msg_idx++; \
+	if ((chip)->msg_idx >= TRACE_ITEM_CNT) { \
+		(chip)->msg_idx = 0; \
+	} \
+	goto label; \
 } while (0)
 #else
 #define TRACE_RET(chip, ret)	return(ret)
Signature · 1 line
1.7.9.5
#6 lore raw

Re: [PATCH 3/3] Fix line over 80 character issue and space before tabs issue in trace.h

Review

Quoted 5 lines · YAMANE Toshiaki

fixed some checkpatch warnings.

(quoted diff) +0 -2
-WARNING: line over 80 characters
-WARNING: please, no space before tabs

These looked nicer in the original, sorry.

regards,
dan carpenter

#7 lore raw

Re: [PATCH 3/3] Fix line over 80 character issue and space before tabs issue in trace.h

Quoted 8 lines · Dan Carpenter

Review

Quoted 5 lines · YAMANE Toshiaki

fixed some checkpatch warnings.

(quoted diff) +0 -2
-WARNING: line over 80 characters
-WARNING: please, no space before tabs

These looked nicer in the original, sorry.

I will destroy this patch series.
thanks.

YAMANE Toshiaki

#8 lore raw
In reply to YAMANE Toshiaki
Quoted 14 lines · YAMANE Toshiaki

fixed below checkpatch error.

-ERROR: trailing whitespace

---
 drivers/staging/rts_pstor/trace.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rts_pstor/trace.h +0 -0
index cf60a1b..740999c 100644

drivers/staging/rts_pstor/trace.h static inline char *filename(char *path) · line 44

Quoted 7 lines
drivers/staging/rts_pstor/trace.h +1 -1
@@ -39,7 +39,7 @@ static inline char *filename(char *path)
 	while (*ptr != '\0') {
 		if ((*ptr == '\\') || (*ptr == '/'))
 			path = ptr + 1;
-		
+
 		ptr++;
 	}

For me it seems total filename() function could be squeezed to just strrchr(path, '/') + 1; Moreover there is already basename() in the lib/dynamic_debug.c you
could rename, export and reuse.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#9 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 9 lines · YAMANE Toshiaki

fixed below checkpatch error.

-ERROR: trailing whitespace

---
 drivers/staging/rts_pstor/trace.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/staging/rts_pstor/trace.h static inline char *filename(char *path) · line 44

Quoted 12 lines
drivers/staging/rts_pstor/trace.h +1 -1
index cf60a1b..740999c 100644
@@ -39,7 +39,7 @@ static inline char *filename(char *path)
      while (*ptr != '\0') {
              if ((*ptr == '\\') || (*ptr == '/'))
                      path = ptr + 1;
-
+
              ptr++;
      }

For me it seems total filename() function could be squeezed to just strrchr(path, '/') + 1; Moreover there is already basename() in the lib/dynamic_debug.c you
could rename, export and reuse.

I will destroy this patch series.
thanks.

YAMANE Toshiaki