import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / conn_md / include / conn_md_log.h
CommitLineData
6fa3eb70
S
1#ifndef __CONN_MD_LOG_H_
2#define __CONN_MD_LOG_H_
3
4
5#include <linux/module.h>
6#include <linux/types.h>
7#include <linux/mutex.h>
8#include <linux/spinlock.h>
9#include <linux/atomic.h>
10#include <linux/list.h>
11#include <linux/dma-mapping.h>
12#include <linux/vmalloc.h>
13#include <linux/sched.h>
14#include <linux/kthread.h>
15#include <linux/workqueue.h>
16#include <linux/interrupt.h>
17#include <linux/fs.h>
18#include <linux/uaccess.h>
19#include <linux/string.h>
20#include <linux/time.h> /* gettimeofday */
21#include <linux/vmalloc.h>
22#include <linux/mm.h>
23#include <linux/device.h>
24#include <linux/init.h>
25#include <linux/delay.h>
26#include <linux/completion.h>
27#include <linux/slab.h>
28#include <linux/proc_fs.h>
29#include <linux/kernel.h>
30
31
32
33#define DBG_LOG_STR_SIZE 512
34
35extern int g_conn_md_dbg_lvl;
36
37extern int __conn_md_get_log_lvl(void);
38extern int conn_md_log_set_lvl(int log_lvl);
39extern int __conn_md_log_print(const char *str, ...);
40
41#define CONN_MD_LOG_LOUD 4
42#define CONN_MD_LOG_DBG 3
43#define CONN_MD_LOG_INFO 2
44#define CONN_MD_LOG_WARN 1
45#define CONN_MD_LOG_ERR 0
46
47#ifndef DFT_TAG
48#define DFT_TAG "[CONN-MD-DFT]"
49#endif
50
51#define CONN_MD_LOUD_FUNC(fmt, arg ...) \
52do { \
53 if (__conn_md_get_log_lvl() >= CONN_MD_LOG_LOUD) \
54 __conn_md_log_print(DFT_TAG "[L]%s:" fmt, \
55 __func__, ## arg); \
56} while (0)
57
58#define CONN_MD_INFO_FUNC(fmt, arg ...) \
59do { \
60 if (__conn_md_get_log_lvl() >= CONN_MD_LOG_INFO)\
61 __conn_md_log_print(DFT_TAG "[I]%s:" fmt, \
62 __func__, ## arg); \
63} while (0)
64
65#define CONN_MD_WARN_FUNC(fmt, arg ...) \
66do { \
67 if (__conn_md_get_log_lvl() >= CONN_MD_LOG_WARN)\
68 __conn_md_log_print(DFT_TAG "[W]%s:" fmt, \
69 __func__, ## arg); \
70} while (0)
71
72#define CONN_MD_ERR_FUNC(fmt, arg ...)\
73do {\
74 if (__conn_md_get_log_lvl() >= CONN_MD_LOG_ERR)\
75 __conn_md_log_print(DFT_TAG "[E]%s(%d):" fmt,\
76 __func__, __LINE__, ## arg);\
77} while (0)
78
79#define CONN_MD_DBG_FUNC(fmt, arg ...) \
80do { \
81 if (__conn_md_get_log_lvl() >= CONN_MD_LOG_DBG) \
82 __conn_md_log_print(DFT_TAG "[D]%s:" fmt, \
83 __func__, ## arg); \
84} while (0)
85
86#define CONN_MD_TRC_FUNC(f) \
87do { \
88 if (__conn_md_get_log_lvl() >= CONN_MD_LOG_DBG) \
89 __conn_md_log_print(DFT_TAG "<%s> <%d>\n", \
90 __func__, __LINE__); \
91} while (0)
92
93
94#endif