1 /******************************************************************************
2  *
3  * Copyright(c) 2009-2012  Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that 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  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *****************************************************************************/
24 
25 #include "wifi.h"
26 
27 #include <linux/moduleparam.h>
28 
29 #ifdef CONFIG_RTLWIFI_DEBUG
30 void _rtl_dbg_trace(struct rtl_priv *rtlpriv, u64 comp, int level,
31 		    const char *fmt, ...)
32 {
33 	if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
34 		     (level <= rtlpriv->cfg->mod_params->debug_level))) {
35 		struct va_format vaf;
36 		va_list args;
37 
38 		va_start(args, fmt);
39 
40 		vaf.fmt = fmt;
41 		vaf.va = &args;
42 
43 		pr_info(":<%lx> %pV", in_interrupt(), &vaf);
44 
45 		va_end(args);
46 	}
47 }
48 EXPORT_SYMBOL_GPL(_rtl_dbg_trace);
49 
50 void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
51 		    const char *fmt, ...)
52 {
53 	if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
54 		     (level <= rtlpriv->cfg->mod_params->debug_level))) {
55 		struct va_format vaf;
56 		va_list args;
57 
58 		va_start(args, fmt);
59 
60 		vaf.fmt = fmt;
61 		vaf.va = &args;
62 
63 		pr_info("%pV", &vaf);
64 
65 		va_end(args);
66 	}
67 }
68 EXPORT_SYMBOL_GPL(_rtl_dbg_print);
69 
70 void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
71 			 const char *titlestring,
72 			 const void *hexdata, int hexdatalen)
73 {
74 	if (unlikely(((comp) & rtlpriv->cfg->mod_params->debug_mask) &&
75 		     ((level) <= rtlpriv->cfg->mod_params->debug_level))) {
76 		pr_info("In process \"%s\" (pid %i): %s\n",
77 			current->comm, current->pid, titlestring);
78 		print_hex_dump_bytes("", DUMP_PREFIX_NONE,
79 				     hexdata, hexdatalen);
80 	}
81 }
82 EXPORT_SYMBOL_GPL(_rtl_dbg_print_data);
83 
84 #endif
85