summaryrefslogtreecommitdiff
path: root/include/linux/rtdefs.h
blob: cc8802d6b7a86754ebe619a51936af7d80aea155 (plain)
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
/*
 * include/linux/rtdefs.h
 *
 * Richtek driver common definitions
 *
 * Copyright (C) 2013 Richtek Technology Corp.
 * Author: Patrick Chang <patrick_chang@richtek.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 */

#ifndef RTDEFS_H
#define RTDEFS_H
#include <linux/kernel.h>

#ifndef RTDBGLEVEL
#define RTDBGLEVEL  3
#endif

#define RTDBGINFO_LEVEL 3
#define RTDBGWARN_LEVEL 2
#define RTDBGERR_LEVEL  1
#define RTDBGFPRN_LEVEL 0


#if RTDBGINFO_LEVEL<=RTDBGLEVEL
#define RTINFO(format, args...) \
	printk(KERN_INFO "%s:%s() line-%d: " format, \
			ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
#define RTINFO_IF(cond, format, args...) \
	if (cond) \
printk(KERN_INFO "%s:%s() line-%d: " format, \
		ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
#else
#define RTINFO(format, args...)
#define RTINFO_IF(cond, format, args...)
#endif

#if RTDBGWARN_LEVEL<=RTDBGLEVEL
#define RTWARN(format, args...) \
	printk(KERN_WARNING "%s:%s() line-%d: " format, \
			ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
#define RTWARN_IF(cond, format, args...) \
	if (cond) \
printk(KERN_WARNING "%s:%s() line-%d: " format, \
		ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
#else
#define RTWARN(format, args...)
#define RTWARN_IF(cond, format, args...)
#endif

#if RTDBGERR_LEVEL<=RTDBGLEVEL
#define RTERR(format, args...) \
	printk(KERN_ERR "%s:%s() line-%d: " format, \
			ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
#define RTERR_IF(cond, format, args...) \
	if (cond) printk(KERN_ERR "%s:%s() line-%d: " format, \
			ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
#else
#define RTERR(format, args...)
#define RTERR_IF(cond, format, args...)
#endif

#if RTDBGFPRN_LEVEL<=RTDBGLEVEL
#define RTPRN(format, args...) \
	printk(KERN_DEBUG "%s:%s() line-%d: " format, \
			ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
#define RTPRN_IF(cond, format, args...) \
	if (cond) printk(KERN_DEBUG "%s:%s() line-%d: " format, \
			ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
#else
#define RTPRN(format, args...)
#define RTPRN_IF(cond, format, args...)
#endif



#endif // RTDEFS_H