2 * drivers/s390/net/ctcm_dbug.c
4 * Copyright IBM Corp. 2001, 2007
5 * Authors: Peter Tiedemann (ptiedem@de.ibm.com)
9 #include <linux/stddef.h>
10 #include <linux/string.h>
11 #include <linux/kernel.h>
12 #include <linux/errno.h>
13 #include <linux/slab.h>
14 #include <linux/ctype.h>
15 #include <linux/sysctl.h>
16 #include <linux/module.h>
17 #include <linux/init.h>
19 #include <linux/debugfs.h>
20 #include "ctcm_dbug.h"
23 * Debug Facility Stuff
26 struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS] = {
27 [CTCM_DBF_SETUP] = {"ctc_setup", 8, 1, 64, CTC_DBF_INFO, NULL},
28 [CTCM_DBF_ERROR] = {"ctc_error", 8, 1, 64, CTC_DBF_ERROR, NULL},
29 [CTCM_DBF_TRACE] = {"ctc_trace", 8, 1, 64, CTC_DBF_ERROR, NULL},
30 [CTCM_DBF_MPC_SETUP] = {"mpc_setup", 8, 1, 80, CTC_DBF_INFO, NULL},
31 [CTCM_DBF_MPC_ERROR] = {"mpc_error", 8, 1, 80, CTC_DBF_ERROR, NULL},
32 [CTCM_DBF_MPC_TRACE] = {"mpc_trace", 8, 1, 80, CTC_DBF_ERROR, NULL},
35 void ctcm_unregister_dbf_views(void)
38 for (x = 0; x < CTCM_DBF_INFOS; x++) {
39 debug_unregister(ctcm_dbf[x].id);
40 ctcm_dbf[x].id = NULL;
44 int ctcm_register_dbf_views(void)
47 for (x = 0; x < CTCM_DBF_INFOS; x++) {
48 /* register the areas */
49 ctcm_dbf[x].id = debug_register(ctcm_dbf[x].name,
53 if (ctcm_dbf[x].id == NULL) {
54 ctcm_unregister_dbf_views();
59 debug_register_view(ctcm_dbf[x].id, &debug_hex_ascii_view);
60 /* set a passing level */
61 debug_set_level(ctcm_dbf[x].id, ctcm_dbf[x].level);
67 void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *fmt, ...)
72 if (level > (ctcm_dbf[dbf_nix].id)->level)
75 vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args);
78 debug_text_event(ctcm_dbf[dbf_nix].id, level, dbf_txt_buf);