alistair23-linux/drivers/staging/rts5208/trace.c
Joe Perches 031366ea65 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>
2015-03-26 13:16:19 +01:00

27 lines
602 B
C

#include <linux/kernel.h>
#include <linux/string.h>
#include "rtsx.h"
#ifdef _MSG_TRACE
void _rtsx_trace(struct rtsx_chip *chip, const char *file, const char *func,
int line)
{
struct trace_msg_t *msg = &chip->trace_msg[chip->msg_idx];
file = kbasename(file);
dev_dbg(rtsx_dev(chip), "[%s][%s]:[%d]\n", file, func, line);
strncpy(msg->file, file, MSG_FILE_LEN - 1);
strncpy(msg->func, func, MSG_FUNC_LEN - 1);
msg->line = (u16)line;
get_current_time(msg->timeval_buf, TIME_VAL_LEN);
msg->valid = 1;
chip->msg_idx++;
if (chip->msg_idx >= TRACE_ITEM_CNT)
chip->msg_idx = 0;
}
#endif