blob: 38fef6dbb44b61573fece5a1d740f0ecdf8c431a [file] [log] [blame]
Larry Finger0c817332010-12-08 11:12:31 -06001/******************************************************************************
2 *
Larry Fingera8d76062012-01-07 20:46:42 -06003 * Copyright(c) 2009-2012 Realtek Corporation.
Larry Finger0c817332010-12-08 11:12:31 -06004 *
Larry Fingerf3a97e92014-09-22 09:39:24 -05005 * This program is free software; you can redistribute it and/or modify it
Larry Finger0c817332010-12-08 11:12:31 -06006 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
Larry Fingerf3a97e92014-09-22 09:39:24 -05009 * This program is distributed in the hope that it will be useful, but WITHOUT
Larry Finger0c817332010-12-08 11:12:31 -060010 * 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 *
Larry Fingerf3a97e92014-09-22 09:39:24 -050014 * The full GNU General Public License is included in this distribution in the
Larry Finger0c817332010-12-08 11:12:31 -060015 * 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
Larry Fingerd273bb22012-01-27 13:59:25 -060027#include <linux/moduleparam.h>
28
Joe Perches9ce22192016-06-25 15:46:45 -070029#ifdef CONFIG_RTLWIFI_DEBUG
Ping-Ke Shih79b64ed2017-06-18 11:12:43 -050030void _rtl_dbg_trace(struct rtl_priv *rtlpriv, u64 comp, int level,
Larry Finger102e2952017-01-19 11:25:19 -060031 const char *fmt, ...)
Joe Perches9ce22192016-06-25 15:46:45 -070032{
Larry Fingerc34df312017-01-19 11:25:20 -060033 if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
34 (level <= rtlpriv->cfg->mod_params->debug_level))) {
Joe Perches9ce22192016-06-25 15:46:45 -070035 struct va_format vaf;
36 va_list args;
37
38 va_start(args, fmt);
39
40 vaf.fmt = fmt;
41 vaf.va = &args;
42
Larry Fingerc34df312017-01-19 11:25:20 -060043 pr_info(":<%lx> %pV", in_interrupt(), &vaf);
Joe Perches9ce22192016-06-25 15:46:45 -070044
45 va_end(args);
46 }
47}
48EXPORT_SYMBOL_GPL(_rtl_dbg_trace);
Larry Finger102e2952017-01-19 11:25:19 -060049
50void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
51 const char *fmt, ...)
52{
Larry Fingerc34df312017-01-19 11:25:20 -060053 if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
54 (level <= rtlpriv->cfg->mod_params->debug_level))) {
Larry Finger102e2952017-01-19 11:25:19 -060055 struct va_format vaf;
56 va_list args;
57
58 va_start(args, fmt);
59
60 vaf.fmt = fmt;
61 vaf.va = &args;
62
Larry Fingerc34df312017-01-19 11:25:20 -060063 pr_info("%pV", &vaf);
Larry Finger102e2952017-01-19 11:25:19 -060064
65 va_end(args);
66 }
67}
68EXPORT_SYMBOL_GPL(_rtl_dbg_print);
69
70void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
71 const char *titlestring,
72 const void *hexdata, int hexdatalen)
73{
Larry Fingerc34df312017-01-19 11:25:20 -060074 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);
Larry Finger102e2952017-01-19 11:25:19 -060078 print_hex_dump_bytes("", DUMP_PREFIX_NONE,
79 hexdata, hexdatalen);
80 }
81}
82EXPORT_SYMBOL_GPL(_rtl_dbg_print_data);
83
Joe Perches9ce22192016-06-25 15:46:45 -070084#endif