1 /* Driver for Realtek PCI-Express card reader
4 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
20 * Wei WANG (wei_wang@realsil.com.cn)
21 * Micky Ching (micky_ching@realsil.com.cn)
24 #ifndef __REALTEK_RTSX_TRACE_H
25 #define __REALTEK_RTSX_TRACE_H
30 static inline char *filename(char *path
)
39 while (*ptr
!= '\0') {
40 if ((*ptr
== '\\') || (*ptr
== '/'))
49 #define TRACE_RET(chip, ret) \
51 char *_file = filename(__FILE__); \
52 dev_dbg(rtsx_dev(chip), "[%s][%s]:[%d]\n", _file, \
53 __func__, __LINE__); \
54 (chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \
55 strncpy((chip)->trace_msg[(chip)->msg_idx].func, __func__, MSG_FUNC_LEN-1); \
56 strncpy((chip)->trace_msg[(chip)->msg_idx].file, _file, MSG_FILE_LEN-1); \
57 get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf, TIME_VAL_LEN); \
58 (chip)->trace_msg[(chip)->msg_idx].valid = 1; \
60 if ((chip)->msg_idx >= TRACE_ITEM_CNT) { \
61 (chip)->msg_idx = 0; \
66 #define TRACE_GOTO(chip, label) \
68 char *_file = filename(__FILE__); \
69 dev_dbg(rtsx_dev(chip), "[%s][%s]:[%d]\n", _file, \
70 __func__, __LINE__); \
71 (chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \
72 strncpy((chip)->trace_msg[(chip)->msg_idx].func, __func__, MSG_FUNC_LEN-1); \
73 strncpy((chip)->trace_msg[(chip)->msg_idx].file, _file, MSG_FILE_LEN-1); \
74 get_current_time((chip)->trace_msg[(chip)->msg_idx].timeval_buf, TIME_VAL_LEN); \
75 (chip)->trace_msg[(chip)->msg_idx].valid = 1; \
77 if ((chip)->msg_idx >= TRACE_ITEM_CNT) { \
78 (chip)->msg_idx = 0; \
83 #define TRACE_RET(chip, ret) return ret
84 #define TRACE_GOTO(chip, label) goto label
87 #endif /* __REALTEK_RTSX_TRACE_H */