aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/mediatek/conn_md/include/conn_md_log.h
blob: f968775affc0f09e6c89bccbfc00375b1082b55b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef __CONN_MD_LOG_H_
#define __CONN_MD_LOG_H_

#include <linux/module.h>
#include <linux/types.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/atomic.h>
#include <linux/list.h>
#include <linux/dma-mapping.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/string.h>
#include <linux/time.h>		/* gettimeofday */
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/completion.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/kernel.h>

#define DBG_LOG_STR_SIZE 512

extern int g_conn_md_dbg_lvl;

extern int __conn_md_get_log_lvl(void);
extern int conn_md_log_set_lvl(int log_lvl);
extern int __conn_md_log_print(const char *str, ...);

#define CONN_MD_LOG_LOUD    4
#define CONN_MD_LOG_DBG     3
#define CONN_MD_LOG_INFO    2
#define CONN_MD_LOG_WARN    1
#define CONN_MD_LOG_ERR     0

#ifndef DFT_TAG
#define DFT_TAG         "[CONN-MD-DFT]"
#endif

#define CONN_MD_LOUD_FUNC(fmt, arg ...) \
do { \
	if (__conn_md_get_log_lvl() >= CONN_MD_LOG_LOUD) \
		__conn_md_log_print(DFT_TAG "[L]%s:"  fmt, \
		__func__, ## arg); \
} while (0)

#define CONN_MD_INFO_FUNC(fmt, arg ...) \
do { \
	if (__conn_md_get_log_lvl() >= CONN_MD_LOG_INFO)\
		__conn_md_log_print(DFT_TAG "[I]%s:"  fmt, \
		__func__, ## arg); \
} while (0)

#define CONN_MD_WARN_FUNC(fmt, arg ...) \
do { \
	if (__conn_md_get_log_lvl() >= CONN_MD_LOG_WARN)\
		__conn_md_log_print(DFT_TAG "[W]%s:"  fmt, \
		__func__, ## arg); \
} while (0)

#define CONN_MD_ERR_FUNC(fmt, arg ...)\
do {\
	if (__conn_md_get_log_lvl() >= CONN_MD_LOG_ERR)\
		__conn_md_log_print(DFT_TAG "[E]%s(%d):"  fmt,\
		__func__, __LINE__, ## arg);\
} while (0)

#define CONN_MD_DBG_FUNC(fmt, arg ...) \
do { \
	if (__conn_md_get_log_lvl() >= CONN_MD_LOG_DBG) \
		__conn_md_log_print(DFT_TAG "[D]%s:"  fmt, \
		__func__, ## arg); \
} while (0)

#define CONN_MD_TRC_FUNC(f) \
do { \
	if (__conn_md_get_log_lvl() >= CONN_MD_LOG_DBG) \
		__conn_md_log_print(DFT_TAG "<%s> <%d>\n", \
		__func__, __LINE__); \
} while (0)

#endif