Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / hv / logging.h
CommitLineData
ab057781
HJ
1/*
2 *
3 * Copyright (c) 2009, Microsoft Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
21 *
22 */
23
24
25#ifndef _LOGGING_H_
26#define _LOGGING_H_
27
454f18a9
BP
28/* #include <linux/init.h> */
29/* #include <linux/module.h> */
ab057781 30
ab057781
HJ
31
32#define VMBUS 0x0001
33#define STORVSC 0x0002
34#define NETVSC 0x0004
35#define INPUTVSC 0x0008
36#define BLKVSC 0x0010
37#define VMBUS_DRV 0x0100
38#define STORVSC_DRV 0x0200
39#define NETVSC_DRV 0x0400
40#define INPUTVSC_DRV 0x0800
41#define BLKVSC_DRV 0x1000
42
43#define ALL_MODULES (VMBUS |\
44 STORVSC |\
45 NETVSC |\
46 INPUTVSC |\
47 BLKVSC |\
48 VMBUS_DRV |\
49 STORVSC_DRV |\
50 NETVSC_DRV |\
51 INPUTVSC_DRV|\
52 BLKVSC_DRV)
53
454f18a9 54/* Logging Level */
a14bd58c
GKH
55#define ERROR_LVL 3
56#define WARNING_LVL 4
57#define INFO_LVL 6
58#define DEBUG_LVL 7
ab057781
HJ
59#define DEBUG_LVL_ENTEREXIT 8
60#define DEBUG_RING_LVL 9
61
62extern unsigned int vmbus_loglevel;
63
ab057781 64#define DPRINT(mod, lvl, fmt, args...) do {\
a14bd58c
GKH
65 if ((mod & (HIWORD(vmbus_loglevel))) && \
66 (lvl <= LOWORD(vmbus_loglevel))) \
67 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
ab057781
HJ
68 } while (0)
69
70#define DPRINT_DBG(mod, fmt, args...) do {\
a14bd58c
GKH
71 if ((mod & (HIWORD(vmbus_loglevel))) && \
72 (DEBUG_LVL <= LOWORD(vmbus_loglevel))) \
73 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
ab057781
HJ
74 } while (0)
75
76#define DPRINT_INFO(mod, fmt, args...) do {\
a14bd58c
GKH
77 if ((mod & (HIWORD(vmbus_loglevel))) && \
78 (INFO_LVL <= LOWORD(vmbus_loglevel))) \
79 printk(KERN_INFO #mod": " fmt "\n", ## args);\
ab057781
HJ
80 } while (0)
81
82#define DPRINT_WARN(mod, fmt, args...) do {\
a14bd58c
GKH
83 if ((mod & (HIWORD(vmbus_loglevel))) && \
84 (WARNING_LVL <= LOWORD(vmbus_loglevel))) \
0b8ffe07 85 printk(KERN_WARNING #mod": WARNING! " fmt "\n", ## args);\
ab057781
HJ
86 } while (0)
87
88#define DPRINT_ERR(mod, fmt, args...) do {\
a14bd58c
GKH
89 if ((mod & (HIWORD(vmbus_loglevel))) && \
90 (ERROR_LVL <= LOWORD(vmbus_loglevel))) \
91 printk(KERN_ERR #mod": %s() ERROR!! " fmt "\n", \
92 __func__, ## args);\
ab057781
HJ
93 } while (0)
94
95#ifdef DEBUG
96#define DPRINT_ENTER(mod) do {\
a14bd58c
GKH
97 if ((mod & (HIWORD(vmbus_loglevel))) && \
98 (DEBUG_LVL_ENTEREXIT <= LOWORD(vmbus_loglevel))) \
0b8ffe07 99 printk(KERN_DEBUG "["#mod"]: %s() enter\n", __func__);\
ab057781
HJ
100 } while (0)
101
102#define DPRINT_EXIT(mod) do {\
a14bd58c
GKH
103 if ((mod & (HIWORD(vmbus_loglevel))) && \
104 (DEBUG_LVL_ENTEREXIT <= LOWORD(vmbus_loglevel))) \
105 printk(KERN_DEBUG "["#mod"]: %s() exit\n", __func__);\
ab057781
HJ
106 } while (0)
107#else
108#define DPRINT_ENTER(mod)
109#define DPRINT_EXIT(mod)
110#endif
111
454f18a9 112#endif /* _LOGGING_H_ */