aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/ctcm_dbug.h
diff options
context:
space:
mode:
authorPeter Tiedemann <ptiedem@de.ibm.com>2008-07-18 09:24:57 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-22 17:53:46 -0400
commitaa3f2cb63086e474a2ac3836d01fc6d9db393846 (patch)
treedfeb9dea4c7bd3a5fce6f223f4e261e6a0fe1ac2 /drivers/s390/net/ctcm_dbug.h
parentb805da74dee3a8de8a29654078c5198f2fb0e15b (diff)
s390/net/ctcm: message cleanup
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com> Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/s390/net/ctcm_dbug.h')
-rw-r--r--drivers/s390/net/ctcm_dbug.h39
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/s390/net/ctcm_dbug.h b/drivers/s390/net/ctcm_dbug.h
index fdff34fe59a2..26966d0b9abd 100644
--- a/drivers/s390/net/ctcm_dbug.h
+++ b/drivers/s390/net/ctcm_dbug.h
@@ -20,16 +20,17 @@
20#else 20#else
21 #define do_debug 0 21 #define do_debug 0
22#endif 22#endif
23#ifdef DEBUGDATA
24 #define do_debug_data 1
25#else
26 #define do_debug_data 0
27#endif
28#ifdef DEBUGCCW 23#ifdef DEBUGCCW
29 #define do_debug_ccw 1 24 #define do_debug_ccw 1
25 #define DEBUGDATA 1
30#else 26#else
31 #define do_debug_ccw 0 27 #define do_debug_ccw 0
32#endif 28#endif
29#ifdef DEBUGDATA
30 #define do_debug_data 1
31#else
32 #define do_debug_data 0
33#endif
33 34
34/* define dbf debug levels similar to kernel msg levels */ 35/* define dbf debug levels similar to kernel msg levels */
35#define CTC_DBF_ALWAYS 0 /* always print this */ 36#define CTC_DBF_ALWAYS 0 /* always print this */
@@ -42,8 +43,6 @@
42#define CTC_DBF_INFO 5 /* informational */ 43#define CTC_DBF_INFO 5 /* informational */
43#define CTC_DBF_DEBUG 6 /* debug-level messages */ 44#define CTC_DBF_DEBUG 6 /* debug-level messages */
44 45
45DECLARE_PER_CPU(char[256], ctcm_dbf_txt_buf);
46
47enum ctcm_dbf_names { 46enum ctcm_dbf_names {
48 CTCM_DBF_SETUP, 47 CTCM_DBF_SETUP,
49 CTCM_DBF_ERROR, 48 CTCM_DBF_ERROR,
@@ -67,6 +66,7 @@ extern struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS];
67 66
68int ctcm_register_dbf_views(void); 67int ctcm_register_dbf_views(void);
69void ctcm_unregister_dbf_views(void); 68void ctcm_unregister_dbf_views(void);
69void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *text, ...);
70 70
71static inline const char *strtail(const char *s, int n) 71static inline const char *strtail(const char *s, int n)
72{ 72{
@@ -74,12 +74,6 @@ static inline const char *strtail(const char *s, int n)
74 return (l > n) ? s + (l - n) : s; 74 return (l > n) ? s + (l - n) : s;
75} 75}
76 76
77/* sort out levels early to avoid unnecessary sprintfs */
78static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level)
79{
80 return (dbf_grp->level >= level);
81}
82
83#define CTCM_FUNTAIL strtail((char *)__func__, 16) 77#define CTCM_FUNTAIL strtail((char *)__func__, 16)
84 78
85#define CTCM_DBF_TEXT(name, level, text) \ 79#define CTCM_DBF_TEXT(name, level, text) \
@@ -94,16 +88,7 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level)
94 } while (0) 88 } while (0)
95 89
96#define CTCM_DBF_TEXT_(name, level, text...) \ 90#define CTCM_DBF_TEXT_(name, level, text...) \
97 do { \ 91 ctcm_dbf_longtext(CTCM_DBF_##name, level, text)
98 if (ctcm_dbf_passes(ctcm_dbf[CTCM_DBF_##name].id, level)) { \
99 char *ctcm_dbf_txt_buf = \
100 get_cpu_var(ctcm_dbf_txt_buf); \
101 sprintf(ctcm_dbf_txt_buf, text); \
102 debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, \
103 level, ctcm_dbf_txt_buf); \
104 put_cpu_var(ctcm_dbf_txt_buf); \
105 } \
106 } while (0)
107 92
108/* 93/*
109 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}. 94 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
@@ -112,13 +97,13 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level)
112 */ 97 */
113#define CTCM_DBF_DEV_NAME(cat, dev, text) \ 98#define CTCM_DBF_DEV_NAME(cat, dev, text) \
114 do { \ 99 do { \
115 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) : %s", \ 100 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \
116 CTCM_FUNTAIL, dev->name, text); \ 101 CTCM_FUNTAIL, dev->name, text); \
117 } while (0) 102 } while (0)
118 103
119#define MPC_DBF_DEV_NAME(cat, dev, text) \ 104#define MPC_DBF_DEV_NAME(cat, dev, text) \
120 do { \ 105 do { \
121 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) : %s", \ 106 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \
122 CTCM_FUNTAIL, dev->name, text); \ 107 CTCM_FUNTAIL, dev->name, text); \
123 } while (0) 108 } while (0)
124 109
@@ -137,13 +122,13 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level)
137 */ 122 */
138#define CTCM_DBF_DEV(cat, dev, text) \ 123#define CTCM_DBF_DEV(cat, dev, text) \
139 do { \ 124 do { \
140 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) : %s", \ 125 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \
141 CTCM_FUNTAIL, dev, text); \ 126 CTCM_FUNTAIL, dev, text); \
142 } while (0) 127 } while (0)
143 128
144#define MPC_DBF_DEV(cat, dev, text) \ 129#define MPC_DBF_DEV(cat, dev, text) \
145 do { \ 130 do { \
146 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) : %s", \ 131 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \
147 CTCM_FUNTAIL, dev, text); \ 132 CTCM_FUNTAIL, dev, text); \
148 } while (0) 133 } while (0)
149 134