diff options
author | Joe Perches <joe@perches.com> | 2015-03-25 12:54:25 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-26 13:16:19 +0100 |
commit | 031366ea65495f787eb792a135f51c093d75a197 (patch) | |
tree | 21b523d33f37b7d66cfcf798cb3ba43be8e1cc61 /drivers/staging/rts5208/trace.h | |
parent | da3c8deef6b392cfe9d19645de2fec9fc2005522 (diff) | |
download | op-kernel-dev-031366ea65495f787eb792a135f51c093d75a197.zip op-kernel-dev-031366ea65495f787eb792a135f51c093d75a197.tar.gz |
staging: rts5208: Remove TRACE_RET and TRACE_GOTO macros
Remove these flow hiding macros.
Miscellanea:
o Add a macro and function to replace a large inline
o Simplify #includes
o Add trace.c and update Makefile
o Remove static inline filename function and use kbasename instead
This reduces object size quite a lot: ~350KB (x86-64 allyesconfig)
$ size drivers/staging/rts5208/built-in.o*
text data bss dec hex filename
248385 36728 77888 363001 589f9 drivers/staging/rts5208/built-in.o.new
506691 83352 115896 705939 ac593 drivers/staging/rts5208/built-in.o.old
Done via coccinelle script and some typing.
@@
expression chip;
expression ret;
@@
- TRACE_RET(chip, ret);
+ rtsx_trace(chip);
+ return ret;
@@
expression chip;
identifier label;
@@
- TRACE_GOTO(chip, label);
+ rtsx_trace(chip);
+ goto label;
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rts5208/trace.h')
-rw-r--r-- | drivers/staging/rts5208/trace.h | 61 |
1 files changed, 7 insertions, 54 deletions
diff --git a/drivers/staging/rts5208/trace.h b/drivers/staging/rts5208/trace.h index a9ab407..5b80787 100644 --- a/drivers/staging/rts5208/trace.h +++ b/drivers/staging/rts5208/trace.h @@ -24,64 +24,17 @@ #ifndef __REALTEK_RTSX_TRACE_H #define __REALTEK_RTSX_TRACE_H -#define _MSG_TRACE +struct rtsx_chip; #ifdef _MSG_TRACE -static inline char *filename(char *path) +void _rtsx_trace(struct rtsx_chip *chip, const char *file, const char *func, + int line); +#define rtsx_trace(chip) \ + _rtsx_trace(chip, __FILE__, __func__, __LINE__) +#else +static inline void rtsx_trace(struct rtsx_chip *chip) { - char *ptr; - - if (path == NULL) - return NULL; - - ptr = path; - - while (*ptr != '\0') { - if ((*ptr == '\\') || (*ptr == '/')) - path = ptr + 1; - - ptr++; - } - - return path; } - -#define TRACE_RET(chip, ret) \ - do { \ - char *_file = filename(__FILE__); \ - dev_dbg(rtsx_dev(chip), "[%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__); \ - dev_dbg(rtsx_dev(chip), "[%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 -#define TRACE_GOTO(chip, label) goto label #endif #endif /* __REALTEK_RTSX_TRACE_H */ |