OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / drivers / s390 / net / ctcm_dbug.h
blob26966d0b9abd1191e3413afa7ca3bcbe42848ddc
1 /*
2 * drivers/s390/net/ctcm_dbug.h
4 * Copyright IBM Corp. 2001, 2007
5 * Authors: Peter Tiedemann (ptiedem@de.ibm.com)
7 */
9 #ifndef _CTCM_DBUG_H_
10 #define _CTCM_DBUG_H_
13 * Debug Facility stuff
16 #include <asm/debug.h>
18 #ifdef DEBUG
19 #define do_debug 1
20 #else
21 #define do_debug 0
22 #endif
23 #ifdef DEBUGCCW
24 #define do_debug_ccw 1
25 #define DEBUGDATA 1
26 #else
27 #define do_debug_ccw 0
28 #endif
29 #ifdef DEBUGDATA
30 #define do_debug_data 1
31 #else
32 #define do_debug_data 0
33 #endif
35 /* define dbf debug levels similar to kernel msg levels */
36 #define CTC_DBF_ALWAYS 0 /* always print this */
37 #define CTC_DBF_EMERG 0 /* system is unusable */
38 #define CTC_DBF_ALERT 1 /* action must be taken immediately */
39 #define CTC_DBF_CRIT 2 /* critical conditions */
40 #define CTC_DBF_ERROR 3 /* error conditions */
41 #define CTC_DBF_WARN 4 /* warning conditions */
42 #define CTC_DBF_NOTICE 5 /* normal but significant condition */
43 #define CTC_DBF_INFO 5 /* informational */
44 #define CTC_DBF_DEBUG 6 /* debug-level messages */
46 enum ctcm_dbf_names {
47 CTCM_DBF_SETUP,
48 CTCM_DBF_ERROR,
49 CTCM_DBF_TRACE,
50 CTCM_DBF_MPC_SETUP,
51 CTCM_DBF_MPC_ERROR,
52 CTCM_DBF_MPC_TRACE,
53 CTCM_DBF_INFOS /* must be last element */
56 struct ctcm_dbf_info {
57 char name[DEBUG_MAX_NAME_LEN];
58 int pages;
59 int areas;
60 int len;
61 int level;
62 debug_info_t *id;
65 extern struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS];
67 int ctcm_register_dbf_views(void);
68 void ctcm_unregister_dbf_views(void);
69 void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *text, ...);
71 static inline const char *strtail(const char *s, int n)
73 int l = strlen(s);
74 return (l > n) ? s + (l - n) : s;
77 #define CTCM_FUNTAIL strtail((char *)__func__, 16)
79 #define CTCM_DBF_TEXT(name, level, text) \
80 do { \
81 debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, level, text); \
82 } while (0)
84 #define CTCM_DBF_HEX(name, level, addr, len) \
85 do { \
86 debug_event(ctcm_dbf[CTCM_DBF_##name].id, \
87 level, (void *)(addr), len); \
88 } while (0)
90 #define CTCM_DBF_TEXT_(name, level, text...) \
91 ctcm_dbf_longtext(CTCM_DBF_##name, level, text)
94 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
95 * dev : netdevice with valid name field.
96 * text: any text string.
98 #define CTCM_DBF_DEV_NAME(cat, dev, text) \
99 do { \
100 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \
101 CTCM_FUNTAIL, dev->name, text); \
102 } while (0)
104 #define MPC_DBF_DEV_NAME(cat, dev, text) \
105 do { \
106 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \
107 CTCM_FUNTAIL, dev->name, text); \
108 } while (0)
110 #define CTCMY_DBF_DEV_NAME(cat, dev, text) \
111 do { \
112 if (IS_MPCDEV(dev)) \
113 MPC_DBF_DEV_NAME(cat, dev, text); \
114 else \
115 CTCM_DBF_DEV_NAME(cat, dev, text); \
116 } while (0)
119 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
120 * dev : netdevice.
121 * text: any text string.
123 #define CTCM_DBF_DEV(cat, dev, text) \
124 do { \
125 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \
126 CTCM_FUNTAIL, dev, text); \
127 } while (0)
129 #define MPC_DBF_DEV(cat, dev, text) \
130 do { \
131 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \
132 CTCM_FUNTAIL, dev, text); \
133 } while (0)
135 #define CTCMY_DBF_DEV(cat, dev, text) \
136 do { \
137 if (IS_MPCDEV(dev)) \
138 MPC_DBF_DEV(cat, dev, text); \
139 else \
140 CTCM_DBF_DEV(cat, dev, text); \
141 } while (0)
143 #endif