2012-10-02 11:53:58

by YAMANE Toshiaki

[permalink] [raw]
Subject: [PATCH 1/3] Fix trailing whitespace in trace.h

fixed below checkpatch error.

-ERROR: trailing whitespace

Signed-off-by: Toshiaki Yamane <[email protected]>
---
drivers/staging/rts_pstor/trace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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

--
1.7.9.5


2012-10-02 11:54:37

by YAMANE Toshiaki

[permalink] [raw]
Subject: [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

Signed-off-by: Toshiaki Yamane <[email protected]>
---
drivers/staging/rts_pstor/trace.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h
index 740999c..a34493c 100644
--- a/drivers/staging/rts_pstor/trace.h
+++ b/drivers/staging/rts_pstor/trace.h
@@ -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
--
1.7.9.5

2012-10-02 11:54:58

by YAMANE Toshiaki

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

fixed some checkpatch warnings.

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

Signed-off-by: Toshiaki Yamane <[email protected]>
---
drivers/staging/rts_pstor/trace.h | 62 ++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h
index a34493c..fdc48cc 100644
--- a/drivers/staging/rts_pstor/trace.h
+++ b/drivers/staging/rts_pstor/trace.h
@@ -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)
--
1.7.9.5

2012-10-02 12:12:11

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 1/3] Fix trailing whitespace in trace.h

On Tue, 2012-10-02 at 20:53 +0900, YAMANE Toshiaki wrote:
> fixed below checkpatch error.
>
> -ERROR: trailing whitespace
>
> Signed-off-by: Toshiaki Yamane <[email protected]>
> ---
> drivers/staging/rts_pstor/trace.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h
> index cf60a1b..740999c 100644
> --- a/drivers/staging/rts_pstor/trace.h
> +++ b/drivers/staging/rts_pstor/trace.h
> @@ -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.


--
Andy Shevchenko <[email protected]>
Intel Finland Oy

2012-10-02 12:13:37

by Andy Shevchenko

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

On Tue, 2012-10-02 at 20:54 +0900, YAMANE Toshiaki wrote:
> fixed some checkpatch below error.
> -ERROR: Macros with complex values should be enclosed in parenthesis
>
> Signed-off-by: Toshiaki Yamane <[email protected]>
> ---
> drivers/staging/rts_pstor/trace.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h
> index 740999c..a34493c 100644
> --- a/drivers/staging/rts_pstor/trace.h
> +++ b/drivers/staging/rts_pstor/trace.h
> @@ -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.


--
Andy Shevchenko <[email protected]>
Intel Finland Oy

2012-10-02 12:22:14

by Dan Carpenter

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

On Tue, Oct 02, 2012 at 08:54:28PM +0900, YAMANE Toshiaki wrote:
> fixed some checkpatch below error.
> -ERROR: Macros with complex values should be enclosed in parenthesis
>
> Signed-off-by: Toshiaki Yamane <[email protected]>
> ---
> drivers/staging/rts_pstor/trace.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h
> index 740999c..a34493c 100644
> --- a/drivers/staging/rts_pstor/trace.h
> +++ b/drivers/staging/rts_pstor/trace.h
> @@ -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

2012-10-02 12:23:40

by Dan Carpenter

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

On Tue, Oct 02, 2012 at 08:54:48PM +0900, YAMANE Toshiaki wrote:
> fixed some checkpatch warnings.
>
> -WARNING: line over 80 characters
> -WARNING: please, no space before tabs
>

These looked nicer in the original, sorry.

regards,
dan carpenter

2012-10-03 00:18:42

by YAMANE Toshiaki

[permalink] [raw]
Subject: Re: [PATCH 1/3] Fix trailing whitespace in trace.h

On Tue, Oct 2, 2012 at 9:12 PM, Andy Shevchenko
<[email protected]> wrote:
> On Tue, 2012-10-02 at 20:53 +0900, YAMANE Toshiaki wrote:
>> fixed below checkpatch error.
>>
>> -ERROR: trailing whitespace
>>
>> Signed-off-by: Toshiaki Yamane <[email protected]>
>> ---
>> drivers/staging/rts_pstor/trace.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h
>> index cf60a1b..740999c 100644
>> --- a/drivers/staging/rts_pstor/trace.h
>> +++ b/drivers/staging/rts_pstor/trace.h
>> @@ -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

2012-10-03 00:19:19

by YAMANE Toshiaki

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

On Tue, Oct 2, 2012 at 9:21 PM, Dan Carpenter <[email protected]> wrote:
> On Tue, Oct 02, 2012 at 08:54:28PM +0900, YAMANE Toshiaki wrote:
>> fixed some checkpatch below error.
>> -ERROR: Macros with complex values should be enclosed in parenthesis
>>
>> Signed-off-by: Toshiaki Yamane <[email protected]>
>> ---
>> drivers/staging/rts_pstor/trace.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h
>> index 740999c..a34493c 100644
>> --- a/drivers/staging/rts_pstor/trace.h
>> +++ b/drivers/staging/rts_pstor/trace.h
>> @@ -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.

I will destroy this patch series.
thanks.


YAMANE Toshiaki

2012-10-03 00:19:49

by YAMANE Toshiaki

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

On Tue, Oct 2, 2012 at 9:23 PM, Dan Carpenter <[email protected]> wrote:
> On Tue, Oct 02, 2012 at 08:54:48PM +0900, YAMANE Toshiaki wrote:
>> fixed some checkpatch warnings.
>>
>> -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